public void Save(MealPlanViewModel mealPlanDisplay) { ApplicationDbContext db = new ApplicationDbContext(); MealPlan mealPlan = new MealPlan(); mealPlan.MealPlanId = mealPlanDisplay.MealPlanId; mealPlan.Description = mealPlanDisplay.Description; mealPlan.PhotoFilePath = mealPlanDisplay.PhotoFilePath; mealPlan.PrepTime = mealPlanDisplay.PrepTime; mealPlan.PrepTimeUnit = mealPlanDisplay.PrepTimeUnit; mealPlan.CostPerServing = mealPlanDisplay.CostPerServing; mealPlan.Active = mealPlanDisplay.Active; mealPlan.Created = DateTime.Now; db.Entry(mealPlan).State = EntityState.Modified; db.SaveChanges(); PreparationRepository preparationRepository = new PreparationRepository(); preparationRepository.ProcessList(mealPlan.MealPlanId, mealPlanDisplay.Preparations); MealPlanAssignedCategoryRepository mealPlanAssignedCategoryRepository = new MealPlanAssignedCategoryRepository(); mealPlanAssignedCategoryRepository.ProcessList(mealPlan.MealPlanId, mealPlanDisplay.MealPlanAssignedCategories); MealPlanAssignedDietPlanRepository mealPlanAssignedDietPlanRepository = new MealPlanAssignedDietPlanRepository(); mealPlanAssignedDietPlanRepository.ProcessList(mealPlan.MealPlanId, mealPlanDisplay.MealPlanAssignedDietPlans); MealPlanAssignedNutrientRepository mealPlanAssignedNutrientRepository = new MealPlanAssignedNutrientRepository(); mealPlanAssignedNutrientRepository.ProcessList(mealPlan.MealPlanId, mealPlanDisplay.MealPlanAssignedNutrients); MealPlanAssignedIngredientRepository mealPlanAssignedIngredientRepository = new MealPlanAssignedIngredientRepository(); mealPlanAssignedIngredientRepository.ProcessList(mealPlan.MealPlanId, mealPlanDisplay.MealPlanAssignedIngredients); MealPlanAssignedDishRepository mealPlanAssignedDishRepository = new MealPlanAssignedDishRepository(); mealPlanAssignedDishRepository.ProcessList(mealPlan.MealPlanId, mealPlanDisplay.MealPlanAssignedDishes); }