public function handle(CreateNewRecipeCommand $command) { $recipe = $this->recipeFactory->createRecipe($command->name); if ($this->recipes->hasRecipeWithName($recipe->getName())) { throw new RecipeAlreadyExistsException(); } $this->recipes->add($recipe); }