wrote up the code for selectCalendarAndFilterEvents (added to the scope
of the controller)