/** * Handle the command, creating a new category record and returning the result. * * @param CommandInterface $command * @return Category */ public function handle(SetupCategoryCommand $command) { $category = $this->factory->create($command->title, $command->description); $this->categories->save($category); $this->dispatch($category->releaseEvents()); return $category; }