// Token: 0x060007C5 RID: 1989 RVA: 0x000387A4 File Offset: 0x000369A4
 private void ThrowIfShuttingDown(MailboxSession mailboxSession, CalendarSyncLogEntry logEntry, List <KeyValuePair <string, object> > customDataToLog)
 {
     if (base.Shutdown)
     {
         CalendarSyncAssistant.Tracer.TraceDebug <object, IExchangePrincipal>((long)this.GetHashCode(), "{0}: Shutdown called during processing of mailbox '{1}'.", TraceContext.Get(), mailboxSession.MailboxOwner);
         Exception ex = new ShutdownException();
         logEntry.ExceptionType       = ex.GetType().FullName;
         logEntry.ProcessingEndTime   = DateTime.UtcNow;
         logEntry.TotalProcessingTime = (long)(logEntry.ProcessingEndTime - logEntry.ProcessingStartTime).TotalMilliseconds;
         customDataToLog.AddRange(logEntry.LogAllData(mailboxSession, null));
         throw ex;
     }
 }
        // Token: 0x060007C4 RID: 1988 RVA: 0x00038530 File Offset: 0x00036730
        protected override void InvokeInternal(InvokeArgs invokeArgs, List <KeyValuePair <string, object> > customDataToLog)
        {
            DateTime       utcNow         = DateTime.UtcNow;
            MailboxSession mailboxSession = invokeArgs.StoreSession as MailboxSession;

            if (mailboxSession == null)
            {
                return;
            }
            CalendarSyncLogEntry calendarSyncLogEntry = new CalendarSyncLogEntry
            {
                ProcessingStartTime = utcNow,
                IsOnDemandJob       = false,
                MailboxGuid         = mailboxSession.MailboxGuid,
                IsArchive           = mailboxSession.MailboxOwner.MailboxInfo.IsArchive,
                TenantGuid          = mailboxSession.MailboxOwner.MailboxInfo.OrganizationId.GetTenantGuid(),
                MailboxType         = mailboxSession.MailboxOwner.RecipientTypeDetails
            };

            this.ThrowIfShuttingDown(mailboxSession, calendarSyncLogEntry, customDataToLog);
            try
            {
                CalendarSyncAssistant.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: CalendarSyncAssistant.InvokeInternal: starting to process mailbox: {1}.", TraceContext.Get(), mailboxSession.MailboxOwner.MailboxInfo.DisplayName);
                ExTimeZone userTimeZone = TimeZoneHelper.GetUserTimeZone(mailboxSession);
                if (userTimeZone != null)
                {
                    mailboxSession.ExTimeZone = userTimeZone;
                    CalendarSyncAssistant.Tracer.TraceDebug <object, ExTimeZone>((long)this.GetHashCode(), "{0}: CalendarSyncAssistant.InvokeInternal: changed session to user configuration time zone: {1}.", TraceContext.Get(), userTimeZone);
                }
                else
                {
                    CalendarSyncAssistant.Tracer.TraceDebug <object, ExTimeZone>((long)this.GetHashCode(), "{0}: CalendarSyncAssistant.InvokeInternal: failed to read user configuration time zone. Use time zone:{1}.", TraceContext.Get(), mailboxSession.ExTimeZone);
                    SharingSyncAssistantLog.LogEntry(mailboxSession, "Failed to read user configuration time zone. Use default session time zone:{0}", new object[]
                    {
                        mailboxSession.ExTimeZone
                    });
                }
                if (string.IsNullOrEmpty(invokeArgs.Parameters))
                {
                    this.CalendarSyncAssistantHelper.ProcessMailbox(mailboxSession, invokeArgs.TimePerTask, invokeArgs.ActivityId, calendarSyncLogEntry);
                }
                else
                {
                    if (this.PerformanceCounters != null)
                    {
                        this.PerformanceCounters.OnDemandRequests.Increment();
                    }
                    calendarSyncLogEntry.IsOnDemandJob = true;
                    this.CalendarSyncAssistantHelper.ProcessFolder(mailboxSession, invokeArgs.Parameters, calendarSyncLogEntry);
                }
                CalendarSyncAssistant.Tracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: CalendarSyncAssistant.InvokeInternal: successfully processed mailbox: {1}.", TraceContext.Get(), mailboxSession.MailboxOwner.MailboxInfo.DisplayName);
            }
            catch (Exception ex)
            {
                if (ex is AIException && ex.InnerException != null)
                {
                    calendarSyncLogEntry.ExceptionType = ex.InnerException.GetType().FullName;
                }
                else
                {
                    calendarSyncLogEntry.ExceptionType = ex.GetType().FullName;
                }
                throw;
            }
            finally
            {
                calendarSyncLogEntry.ProcessingEndTime   = DateTime.UtcNow;
                calendarSyncLogEntry.TotalProcessingTime = (long)(calendarSyncLogEntry.ProcessingEndTime - utcNow).TotalMilliseconds;
                customDataToLog.AddRange(calendarSyncLogEntry.LogAllData(mailboxSession, invokeArgs.Parameters));
            }
        }