/// <summary>
        /// This is the default action.
        /// It queries the events first by the two calendars.
        /// If there are no events registered in the calendars,
        /// the method calls the internal static class which creates the 10 events
        /// and assigns them to the calendars.
        /// The expression continues with querying the data
        /// according to the passed nullable parameters for filtering and ordering
        /// and then returns the Index View with the Index View Model.
        /// </summary>

        public ActionResult Index(DateTime?filterDate, int?calendarName, int?orderBy)
        {
            IQueryable <Event> events = manager.GetEvents()
                                        .Where(ev => ev.Parent.Title == Constants.CalendarOne ||
                                               ev.Parent.Title == Constants.CalendarTwo);

            if (!events.Any())
            {
                CustomEvents.CreateEvents();
            }
            // Queries only the events which are Visible and have Live status
            events = events.Where(ev => ev.Visible == true)
                     .Where(ev => ev.Status == ContentLifecycleStatus.Live);

            //The query expression filters the data by date if such is passed as a parameter.
            if (filterDate != null)
            {
                events = events.Where(ev => ev.EventStart == filterDate) ??
                         throw new ArgumentNullException(Constants.NoEvents);
                TempData["Message"] = Constants.NoEvents;
            }
            //The query expression filters the data by calendar if a calendar is passed as a parameter.
            if (calendarName != null)
            {
                var calendar = Enum.GetName(typeof(CalendarNames), calendarName);
                events = events.Where(ev => ev.Parent.Title.Contains(calendar));
            }
            //The query expression orders the events if an ordering parameter is passed.
            if (orderBy != null)
            {
                switch (orderBy)
                {
                case 1: events = events.OrderBy(ev => ev.EventStart); break;

                case 2: events = events.OrderBy(ev => ev.EventEnd); break;

                case 3: events = events.OrderBy(ev => ev.Title); break;

                default:
                    break;
                }
            }
            //Creates IndexViewModel of the events and return Index View with it.
            var eventsModel = events.Select(ev => new EventViewModel(ev));
            var model       = new IndexViewModel(eventsModel);

            return(View("Index", model));
        }