public String getEnrollmentStatus(Course course, List <Registration> registrations, Attendee attendee) { String enrollmentStatus = "Wait Listed"; List <Registration> enrolledAttendees = registrations.OrderBy(o => o.getDateTime()) .Where(o => o.getCourseId() == course.getId()) .Take((int)course.getCapacity()) .ToList(); for (int i = 0; i < enrolledAttendees.Count; i++) { if (attendee.getId() == enrolledAttendees[i].getAttendeeId()) { enrollmentStatus = "Registered"; } } return(enrollmentStatus); }