protected function throw404IfNotFound($entity, $message = 'Not Found') { if (!$entity) { throw new NotFoundHttpException('The resource not found.'); } return true; }