public MainWindowViewModel()
        {
            AppointmentCollection = new ObservableCollection <Appointment>(_calendarsCatalog.GetCalendarAppointments());
            foreach (var provider in _calendarsCatalog.GetProviders)
            {
                AddElementToTree(provider);
                foreach (var calendar in provider.GetCalendars())
                {
                    AddElementToTree(calendar);
                }
            }
            var appointmentList = _calendarsCatalog.GetCalendarAppointments().ToList();

            AppointmentCollection = new ObservableCollection <Appointment>(appointmentList);

            foreach (var a in appointmentList)
            {
                // Make sure we don't get any duplicates
                if (!_appointments.ContainsKey(a.Id))
                {
                    _appointments.Add(a.Id, a);
                }
            }

            var calendars = _calendarsCatalog.GetCalendars();

            calendars.ToArray();

            FlyoutViewModel = new FlyoutViewModel
            {
                AddAppointmentAction    = AddAppointment,
                UpdateAppointmentAction = UpdateAppointment,
                RemoveAppointmentAction = RemoveAppointment
            };
        }
 public void CloseInnerFlyout()
 {
     if (FlyoutViewModel.IsEdited)
     {
         FlyoutViewModel.OkCommandeExecute();
     }
     else
     {
         FlyoutViewModel.IsOpen = false;
     }
 }