private void HandleException(GoogleApiException ex, string errorMsg, CalendarItem item = null, RetryAction action = 0)
        {
            if (ex.HttpStatusCode == HttpStatusCode.BadRequest || ex.HttpStatusCode == HttpStatusCode.InternalServerError)
            {
                MessageBox.Show(errorMsg, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (ex.HttpStatusCode == HttpStatusCode.Unauthorized)
            {
                // Reauthenticate
                m_service.Dispose();
                m_service = null;
                PerformAuthentication();

                CreateRetry(item, action);
            }
            else if (ex.HttpStatusCode == HttpStatusCode.Conflict)
            {
                if (item != null)
                {
                    item.CalendarItemIdentifier.GoogleId = GuidCreator.Create();
                }

                CreateRetry(item, action);
            }
            else if (ex.HttpStatusCode == HttpStatusCode.Forbidden)
            {
                CreateRetry(item, action);
            }
        }
        /// <summary>
        /// Fills this CalendarItem with the data from an Outlook AppointmentItem object
        /// </summary>
        /// <param name="item">The Outlook AppointmentItem to use</param>
        /// <param name="createID">Specify if you need to create and ID.</param>
        public void LoadFromOutlookAppointment(AppointmentItem item, bool createID = true)
        {
            m_source = "Outlook";

            Start    = item.Start.ToString(DateTimeFormatString);
            End      = item.End.ToString(DateTimeFormatString);
            Body     = item.Body;
            Subject  = item.Subject;
            Location = item.Location;
            m_isUsingDefaultReminders = !item.ReminderSet;
            ReminderTime        = m_isUsingDefaultReminders ? DEFAULT_REMINDER_TIME : item.ReminderMinutesBeforeStart;
            StartTimeZone       = TimeZoneConverter.WindowsToIana(item.StartTimeZone.ID);
            EndTimeZone         = TimeZoneConverter.WindowsToIana(item.EndTimeZone.ID);
            IsAllDayEvent       = item.AllDayEvent;
            StartTimeInTimeZone = item.StartInStartTimeZone.ToString(DateTimeFormatString);
            EndTimeInTimeZone   = item.EndInEndTimeZone.ToString(DateTimeFormatString);

            string entryId   = null;
            string globalId  = null;
            bool   useParent = false;

            // This ensures that if we grab a occurence of a recurring appointment we use the proper global ID.
            // You must use the MasterAppointment's global ID since that is what I track.
            if (item.IsRecurring)
            {
                if (item.RecurrenceState != OlRecurrenceState.olApptMaster)
                {
                    if (item.Parent is AppointmentItem parent)
                    {
                        entryId   = parent.EntryID;
                        globalId  = parent.GlobalAppointmentID;
                        useParent = true;
                    }
                }
            }

            // Outlook is f*****g stupid and changes the GlobalAppointmentID everytime it restarts but doesn't change the EntryID so use one or the other.
            var id = Archiver.Instance.FindIdentifier(useParent ? entryId : item.EntryID) ?? Archiver.Instance.FindIdentifier(useParent ? globalId : item.GlobalAppointmentID);

            if (id == null)
            {
                CalendarItemIdentifier.OutlookEntryId  = useParent ? entryId : item.EntryID;
                CalendarItemIdentifier.OutlookGlobalId = useParent ? globalId : item.GlobalAppointmentID;
            }
            else
            {
                CalendarItemIdentifier = id;
            }

            if (string.IsNullOrEmpty(CalendarItemIdentifier.GoogleId))
            {
                if (createID)
                {
                    CalendarItemIdentifier.GoogleId = GuidCreator.Create();
                }
            }

            // Check if the event is recurring
            if (item.IsRecurring)
            {
                var recure = item.GetRecurrencePattern();
                Recurrence = new Recurrence(recure);
                //Recurrence.AdjustRecurrenceOutlookPattern( item.Start, item.End );
            }

            // Add attendees
            if (!string.IsNullOrEmpty(item.OptionalAttendees))
            {
                if (item.OptionalAttendees.Contains(";"))
                {
                    var attendees = item.OptionalAttendees.Split(';');
                    foreach (var attendee in attendees)
                    {
                        ContactItem contact = ContactItem.GetContactItem(attendee);
                        Attendees.Add(contact != null
                            ? new Attendee(contact.Name, contact.Email, false)
                            : new Attendee(attendee, false));
                    }
                }
                else
                {
                    ContactItem contact = ContactItem.GetContactItem(item.OptionalAttendees);
                    Attendees.Add(contact != null
                        ? new Attendee(contact.Name, contact.Email, true)
                        : new Attendee(item.OptionalAttendees, true));
                }
            }

            // Grab the required attendees.
            if (!string.IsNullOrEmpty(item.RequiredAttendees))
            {
                if (item.RequiredAttendees.Contains(";"))
                {
                    var attendees = item.RequiredAttendees.Split(';');
                    foreach (var attendee in attendees)
                    {
                        ContactItem contact = ContactItem.GetContactItem(attendee);
                        Attendees.Add(contact != null
                            ? new Attendee(contact.Name, contact.Email, true)
                            : new Attendee(attendee, true));
                    }
                }
                else
                {
                    ContactItem contact = ContactItem.GetContactItem(item.RequiredAttendees);
                    Attendees.Add(contact != null
                        ? new Attendee(contact.Name, contact.Email, true)
                        : new Attendee(item.RequiredAttendees, true));
                }
            }

            CalendarItemIdentifier.EventHash = EventHasher.GetHash(this);
        }