private function getUserEntity($id = null)
    {
        if (empty($id)) {
            return new Entity\Users();
        } elseif (!$userEntity = $this->getUser($id)) {
            $this->flashes()->error(Trans::__('general.phrase.user-not-exist'));

            return false;
        }

        $currentUser = $this->getUser();
        if (!$this->app['permissions']->isAllowedToManipulate($userEntity->toArray(), $currentUser->toArray())) {
            // Verify the current user has access to edit this user
            $this->flashes()->error(Trans::__('general.phrase.access-denied-privilege-edit-user'));

            return false;
        }

        return $userEntity;
    }