         private let refreshService: RefreshService
         private var events = [Event]()
         private var favouriteEvents = [EventIdentifier]()
-
+        
         init(schedule: EventsSchedule,
              eventsService: EventsService,
              hoursDateFormatter: HoursDateFormatter,

                                          eventsService: eventsService,
                                          shortFormDayAndTimeFormatter: shortFormDayAndTimeFormatter,
                                          hoursDateFormatter: hoursDateFormatter)

        eventsService.add(self)
    }

    // MARK: ScheduleInteractor

    func makeViewModel(completionHandler: @escaping (ScheduleViewModel) -> Void) {
        completionHandler(viewModel)
    }

    func makeSearchViewModel(completionHandler: @escaping (ScheduleSearchViewModel) -> Void) {
        completionHandler(searchViewModel)
    }

    // MARK: EventsServiceObserver

    func favouriteEventsDidChange(_ identifiers: [EventIdentifier]) {
        viewModel.favouriteEventsDidChange(identifiers)
        searchViewModel.favouriteEventsDidChange(identifiers)
    }

    func eventsDidChange(to events: [Event]) {}
    func runningEventsDidChange(to events: [Event]) {}
    func upcomingEventsDidChange(to events: [Event]) {}

    // MARK: Private

    private class ViewModel: ScheduleViewModel, EventsScheduleDelegate, RefreshServiceObserver {

        private struct EventsGroupedByDate {
            var date: Date
            var events: [Event]

            func compare(against: EventsGroupedByDate) -> Bool {
                return date < against.date
            }
        }

        private var delegate: ScheduleViewModelDelegate?
        private var rawModelGroups = [EventsGroupedByDate]()

        private var days = [Day]()
        var dayViewModels: [ScheduleDayViewModel] = [] {
            didSet {
                delegate?.scheduleViewModelDidUpdateDays(dayViewModels)
            }
        }

        var eventGroupViewModels: [ScheduleEventGroupViewModel] = [] {
            didSet {
                delegate?.scheduleViewModelDidUpdateEvents(eventGroupViewModels)
            }
        }

        private let schedule: EventsSchedule
        private let eventsService: EventsService
        private let hoursDateFormatter: HoursDateFormatter

            self.hoursDateFormatter = hoursDateFormatter
            self.shortFormDateFormatter = shortFormDateFormatter
            self.refreshService = refreshService
            
            refreshService.add(self)
            schedule.setDelegate(self)
        }
        
        var selectedDayIndex = 0
        
        fileprivate func regenerateEventViewModels() {
            let groupedByDate = Dictionary(grouping: events, by: { $0.startDate })
            rawModelGroups = groupedByDate.map(EventsGroupedByDate.init).sorted(by: { (first, second) -> Bool in
                return first.compare(against: second)
            })
            
            eventGroupViewModels = rawModelGroups.map { (group) -> ScheduleEventGroupViewModel in
                let title = hoursDateFormatter.hoursString(from: group.date)
                let viewModels = group.events.map { (event) -> EventViewModel in
                    return EventViewModel(title: event.title,
                                          startTime: hoursDateFormatter.hoursString(from: event.startDate),
                                          endTime: hoursDateFormatter.hoursString(from: event.endDate),
                                          location: event.room.name,
