public static List <Appointment> GetParticipantsWantedAppointments(List <User> selectedUsers, AppointmentDatabase appointmentDatabase, Appointment selectedAppointment) { List <Appointment> selectedUsersAppointments = new List <Appointment>(); if (selectedUsers != null && appointmentDatabase != null) { foreach (User user in selectedUsers) { selectedUsersAppointments.AddRange(appointmentDatabase.GetSelectedUserWantedAppointments(user, selectedAppointment)); } } return(selectedUsersAppointments); }