public void AddIngredient(Ingredient ingredient) { if (!_ingredientRepository.ExistsByName(ingredient.Name)) { _ingredientRepository.Add(ingredient); return; } var existingIngredient = _ingredientRepository.FindByName(ingredient.Name); ingredient.Id = existingIngredient.Id; ingredient.Stock += existingIngredient.Stock; _ingredientRepository.Update(existingIngredient.Id, ingredient); }