List<INGREDIENT> selectedIngredients = db.INGREDIENT .Where(i => model.SelectedIngredients.Contains(i.IngredientId)) .AsEnumerable() .OrderBy(i => model.SelectedIngredients.IndexOf(i.IngredientId)) .ToList();