/**
  * Returns a record by task id and project id, or throws a 404 error
  * Checks if the resource belongs to the authenticated
  *
  * @param int $id   The Project id
  * @param $project
  * @return mixed
  */
 protected function getOrError($id, Project $project)
 {
     if ($project->getUser() != $this->getUser()) {
         throw $this->createAccessDeniedException();
     }
     $handler = $this->getHandler();
     $data = $handler->get($id, $project);
     if (null === $data) {
         throw new NotFoundHttpException();
     }
     return $data;
 }