/**
  * @param EditCategoryRequest $request
  */
 public function execute(EditCategoryRequest $request)
 {
     $category = $this->categoryRepository->findById($request->getCategoryId());
     $category->compose($request->getName());
     $this->categoryRepository->update($category);
     $this->categoryUpdated();
 }
 /**
  * @param string $name
  * @return CategoryInterface
  */
 private function getCategoryFromListByName($name)
 {
     /** @var CategoryInterface[] $items */
     $items = array_filter($this->categoryRepository->findAll(), function (CategoryInterface $category) use($name) {
         return $category->getName() == $name;
     });
     $id = null;
     if (count($items)) {
         $id = array_values($items)[0]->getId();
     }
     return $this->categoryRepository->findById($id);
 }