public function deleteUserGroup($id)
{
try {
// Find the group using the group id
$group = Sentry::findGroupById($id);
$users = Sentry::findAllUsersInGroup($group);
if ($users->count() > 0) {
throw new Exception('Some users are associated with the selected user group.
First change the user group of those users or delete those users.');
}
// Delete the group
$group->delete();
$message = trans('success_messages.user_group_delete');
return $message;
} catch (GroupNotFoundException $e) {
throw new Exception('Group was not found.');
}
}