public function delete($id = null)
    {
        $this->request->allowMethod(['post', 'delete']);

        $group = $this->UsersGroups->get($id);

        //Before deleting, checks if the group is a necessary group or if the group has some users
        if ($id > 3 && !$group->user_count) {
            $this->UsersGroups->deleteOrFail($group);

            $this->Flash->success(I18N_OPERATION_OK);
        } else {
            $this->Flash->alert($id <= 3 ? __d('me_cms', 'You cannot delete this users group') : I18N_BEFORE_DELETE);
        }

        return $this->redirect(['action' => 'index']);
    }