public static VolunteerEditData CreateEditDataFromVolunteer( Volunteer volunteer, IRepository repo) { var ved = new VolunteerEditData { Volunteer = volunteer, VolunteerTimeSlots = repo.GetAllVolunteerTimeSlots(), ChosenTimeSlots = new int[volunteer.VolunteersVolunteerTimeSlots.Count], Foods = new SelectList(repo.GetAllFoods(), "id", "name"), TShirtSizes = new SelectList(repo.GetAllTShirtSizes(), "id", "name") }; for (int i = 0; i < volunteer.VolunteersVolunteerTimeSlots.Count; i++) { ved.ChosenTimeSlots[i] = volunteer.VolunteersVolunteerTimeSlots.ElementAt(i).volunteer_timeslot_id; } return ved; }