public function find($categoryId) { $category = $this->categoryRepo->find($categoryId); if (is_null($category)) { $error = 'Category Not Found'; throw new CategoryNotFoundException($error); } return $category; }