/**
  * Gets a user for to create or update entity
  *
  * @param $id
  *
  * @return User
  * @throws EntityNotFoundException
  */
 private function getUser($id)
 {
     if (!$id) {
         return new User();
     } else {
         $user = $this->repository->find($id);
         if (!$user) {
             throw new EntityNotFoundException();
         }
         return $user;
     }
 }
 public function supportsClass($class)
 {
     return $this->repository->getClassName() === $class || is_subclass_of($class, $this->repository->getClassName());
 }