private void AddTimeSlot(List<TimeSlot> timeSlots, string start, string end)
        {
            var availableStart = TimeSpan.Parse(start);
            var availableEnd = TimeSpan.Parse(end);

            TimeSlot timeSlot = new TimeSlot
            {
                Start = availableStart.Hours > 9 ? availableStart.Hours.ToString() : string.Format("0{0}", availableStart.Hours),
                Value = string.Format("{0} - {1}", availableStart.ToString(@"hh\:mm"), availableEnd.ToString(@"hh\:mm"))
            };
            timeSlots.Add(timeSlot);
        }
        public async Task<JsonResult> GetAvailableTimeSlots(string localTimeUtc)
        {
            // Call the GetExchangeClient method, which will authenticate
            // the user and create the ExchangeClient object.
            var client = await O365Util.GetOutlookClient(Capabilities.Calendar);

            //Get the Utc time from 9 AM to 6 PM 
            DateTime startLocalTimeUtc = Convert.ToDateTime(localTimeUtc).ToUniversalTime();
            var beginTime = startLocalTimeUtc.AddHours(9);
            var endTime = startLocalTimeUtc.AddHours(18);

            //Get all time slot that we need within 9AM - 6 PM
            List<TimeSlot> timeSlots = new List<TimeSlot>();
            for (var i = 9; i < 18; i++)
            {
                TimeSlot timeSlot = new TimeSlot
                {
                    Start = i,
                    Value = string.Format("{0}:00 - {1}:00", i, i + 1)
                };
                timeSlots.Add(timeSlot);
            }

           List<CalendarEvent> myEvents = new List<CalendarEvent>();

            // Use the ExchangeClient object to call the Calendar API.
            // Get all events that have an end time after now.
            var eventsResults = await (from i in client.Me.Events
                                       where ((i.Start >= beginTime && i.Start <= endTime) || (i.End >= beginTime && i.End <= endTime) || (i.Start <= beginTime && i.End >= endTime))
                                       select i).Take(10).ExecuteAsync();

            // Order the results by start time.
            var events = eventsResults.CurrentPage.OrderBy(e => e.Start);

            // Create a CalendarEvent object for each event returned
            // by the API.
            foreach (Event calendarEvent in events)
            {
                if (calendarEvent.ShowAs == FreeBusyStatus.Busy)
                {
                    var Start = calendarEvent.Start.GetValueOrDefault().DateTime;
                    var End = calendarEvent.End.GetValueOrDefault().DateTime;

                    //Remove all time slot which is between Start and End
                    RemoveBusyTime(startLocalTimeUtc, timeSlots, Start, End);
                }
            }
            
            return Json(timeSlots, JsonRequestBehavior.AllowGet);
        }