private List <Activity> GetSelectedActivities(string[] selectedActivities, AppointmentRepository repository) { List <Activity> result = new List <Activity>(); result.AddRange(repository.Activities(a => selectedActivities.Any(s => a.Id.ToString() == s))); return(result); }