public async Task <Int32> AddRecipe(RecipeDto recipe) { var recipeIdResult = await _recipesRepository.AddRecipe(new Recipe { Name = recipe.Name, Instructions = recipe.Instructions, UserId = recipe.UserId, }); await _recipesRepository.AddIngredients(recipe.Ingredients.Select(i => new Ingredient { Name = i.Name, Quantity = i.Quantity, RecipeId = recipeIdResult }).ToList()); return(recipeIdResult); }