// Token: 0x06001248 RID: 4680 RVA: 0x000689D4 File Offset: 0x00066BD4
        private AssistantTaskContext InitializeContextInternal(MailboxData mailbox, TimeBasedDatabaseJob job)
        {
            OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.InitializeContextInternal: start", new object[0]);
            AssistantTaskContext result;

            try
            {
                if (mailbox is OABGeneratorMailboxData)
                {
                    result = OABGeneratorTaskContext.FromAssistantTaskContext(new AssistantTaskContext(mailbox, job, null));
                }
                else if (mailbox is StoreMailboxData)
                {
                    StoreMailboxData  storeMailboxData            = (StoreMailboxData)mailbox;
                    ADSessionSettings sessionSettings             = OABVariantConfigurationSettings.IsMultitenancyEnabled ? ADSessionSettings.FromTenantPartitionHint(storeMailboxData.TenantPartitionHint) : ADSessionSettings.FromRootOrgScopeSet();
                    ADUser            organizationalMailboxFromAD = this.GetOrganizationalMailboxFromAD(sessionSettings, storeMailboxData.Guid);
                    if (organizationalMailboxFromAD == null)
                    {
                        OABLogger.LogRecord(TraceType.ErrorTrace, "OABGeneratorAssistant.InitializeContext: ignoring scheduled job due to unknown organization mailbox: {0}", new object[]
                        {
                            storeMailboxData.Guid
                        });
                        result = null;
                    }
                    else if (organizationalMailboxFromAD.RecipientTypeDetails != RecipientTypeDetails.ArbitrationMailbox || !organizationalMailboxFromAD.PersistedCapabilities.Contains(Capability.OrganizationCapabilityOABGen))
                    {
                        OABLogger.LogRecord(TraceType.ErrorTrace, "OABGeneratorAssistant.InitializeContext: The mailbox {0} is not an organizational mailbox with OABGen capability", new object[]
                        {
                            storeMailboxData.Guid
                        });
                        result = null;
                    }
                    else
                    {
                        OABGeneratorMailboxData mailboxData             = new OABGeneratorMailboxData(organizationalMailboxFromAD.OrganizationId, base.DatabaseInfo.Guid, organizationalMailboxFromAD.ExchangeGuid, organizationalMailboxFromAD.DisplayName, organizationalMailboxFromAD.Sid, organizationalMailboxFromAD.PrimarySmtpAddress.Domain, Guid.Empty, storeMailboxData.TenantPartitionHint, string.Empty);
                        OABGeneratorTaskContext oabgeneratorTaskContext = OABGeneratorTaskContext.FromAssistantTaskContext(new AssistantTaskContext(mailboxData, job, null));
                        oabgeneratorTaskContext.OrganizationMailbox = organizationalMailboxFromAD;
                        result = oabgeneratorTaskContext;
                    }
                }
                else
                {
                    OABLogger.LogRecord(TraceType.ErrorTrace, "OABGeneratorAssistant.InitializeContext: MailboxData is neither StoreMailboxData nor OABGeneratorMailboxData", new object[0]);
                    result = null;
                }
            }
            catch (CannotResolveExternalDirectoryOrganizationIdException ex)
            {
                OABLogger.LogRecord(TraceType.ErrorTrace, "OABGeneratorAssistant.InitializeContext: {0}", new object[]
                {
                    ex.ToString()
                });
                result = null;
            }
            finally
            {
                OABLogger.LogRecord(TraceType.FunctionTrace, "OABGeneratorAssistant.InitializeContextInternal: finish", new object[0]);
            }
            return(result);
        }
        // Token: 0x0600124F RID: 4687 RVA: 0x00069654 File Offset: 0x00067854
        protected override void InvokeInternal(InvokeArgs invokeArgs, List <KeyValuePair <string, object> > customDataToLog)
        {
            AssistantTaskContext assistantTaskContext = OABGeneratorTaskContext.FromAssistantTaskContext(new AssistantTaskContext(invokeArgs.MailboxData, null, null)
            {
                Step = new AssistantStep(this.InitialStep)
            });

            this.isRunningFromInvoke = true;
            do
            {
                AssistantTaskContext assistantTaskContext2 = assistantTaskContext;
                assistantTaskContext2.Args = invokeArgs;
                assistantTaskContext       = assistantTaskContext2.Step(assistantTaskContext2);
            }while (assistantTaskContext != null && assistantTaskContext.Step != null);
        }