public static List <StudentWorker> GetStudentWorkers() { // the selected worker IDs from application settings StringCollection selectedWorkers = Properties.Settings.Default.SelectedWorkers; List <StudentWorker> studentWorkers = DatabaseManager.GetStudentWorkers(); foreach (StudentWorker sw in studentWorkers) { // set the class and work schedule of the student worker sw.ClassSchedule = DatabaseManager.GetSchedule(sw.StudentID, CalendarEvent.CLASS); sw.WorkSchedule = DatabaseManager.GetSchedule(sw.StudentID, CalendarEvent.WORK); sw.BuildAvailabilitySchedule(); // set selected student workers as selected if (selectedWorkers.Contains(sw.StudentID.ToString())) { sw.Selected = true; } } return(studentWorkers); }