public List <MostUsedRoom> GetMostUsedClassroomsByLessons(IClassroomRepository classroomRepository, int amount, int week) { var allRooms = classroomRepository.GetAllClassroomsWithCoursesRemoveEmpty(week); var orderedRooms = allRooms.OrderByDescending(r => r.Courses.Count).Take(amount).ToList(); var statistics = orderedRooms.Select(s => new MostUsedRoom { RoomId = s.RoomId, Top = orderedRooms.IndexOf(s), AmountOfLessons = s.Courses.Count, }).ToList(); return(statistics); }