// Token: 0x06001393 RID: 5011 RVA: 0x0007258C File Offset: 0x0007078C
        protected override void HandleEventInternal(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item, List <KeyValuePair <string, object> > customDataToLog)
        {
            if (ObjectClass.IsMailboxDiscoverySearchRequest(mapiEvent.ObjectClass) && (mapiEvent.EventMask & MapiEventTypeFlags.ObjectCreated) == MapiEventTypeFlags.ObjectCreated && itemStore != null && item != null)
            {
                DiscoverySearchEventBasedAssistant.< > c__DisplayClassf CS$ < > 8__locals2 = new DiscoverySearchEventBasedAssistant.< > c__DisplayClassf();
                DiscoverySearchEventBasedAssistant.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Processing discovery search arbitration mailbox: {0}", itemStore.MailboxOwnerLegacyDN);
                CS$ < > 8__locals2.name = item.GetValueOrDefault <string>(DiscoverySearchEventBasedAssistant.AlternativeId, null);
                if (string.IsNullOrEmpty(CS$ < > 8__locals2.name))
                {
                    return;
                }
                ActionRequestType valueOrDefault = item.GetValueOrDefault <ActionRequestType>(DiscoverySearchEventBasedAssistant.AsynchronousActionRequest, ActionRequestType.None);
                string            rbacContext    = null;
                try
                {
                    rbacContext = item.GetValueOrDefault <string>(DiscoverySearchEventBasedAssistant.AsynchronousActionRbacContext, null);
                }
                catch (PropertyTooBigException)
                {
                    using (Stream stream = item.PropertyBag.OpenPropertyStream(DiscoverySearchEventBasedAssistant.AsynchronousActionRbacContext, PropertyOpenMode.ReadOnly))
                    {
                        using (StreamReader streamReader = new StreamReader(stream, Encoding.Unicode))
                        {
                            rbacContext = streamReader.ReadToEnd();
                        }
                    }
                }
                SearchEventLogger.Instance.LogDiscoverySearchRequestPickedUpEvent(CS$ < > 8__locals2.name, valueOrDefault.ToString(), rbacContext, itemStore.MailboxOwner.MailboxInfo.OrganizationId.ToString());
                switch (valueOrDefault)
                {
                case ActionRequestType.Start:
                    this.CallSearchService(itemStore, CS$ < > 8__locals2.name, (Item)item, delegate(MailboxSearchClient client, SearchId searchId)
                    {
                        DiscoverySearchEventBasedAssistant.RpcCallWithRetry(delegate()
                        {
                            client.StartEx(searchId, rbacContext);
                        });
                    });
                    SearchEventLogger.Instance.LogDiscoverySearchStartRequestProcessedEvent(CS$ < > 8__locals2.name, rbacContext, itemStore.MailboxOwner.MailboxInfo.OrganizationId.ToString());
                    break;

                case ActionRequestType.Stop:
                    this.CallSearchService(itemStore, CS$ < > 8__locals2.name, (Item)item, delegate(MailboxSearchClient client, SearchId searchId)
                    {
                        DiscoverySearchEventBasedAssistant.RpcCallWithRetry(delegate()
                        {
                            client.AbortEx(searchId, rbacContext);
                        });
                    });
                    SearchEventLogger.Instance.LogDiscoverySearchStopRequestProcessedEvent(CS$ < > 8__locals2.name, rbacContext, itemStore.MailboxOwner.MailboxInfo.OrganizationId.ToString());
                    break;

                case ActionRequestType.Restart:
                    this.CallSearchService(itemStore, CS$ < > 8__locals2.name, (Item)item, delegate(MailboxSearchClient client, SearchId searchId)
                    {
                        DiscoverySearchEventBasedAssistant.RpcCallWithRetry(delegate()
                        {
                            client.Remove(searchId, false);
                        });
                        SearchEventLogger.Instance.LogDiscoverySearchRemoveRequestProcessedEvent(CS$ < > 8__locals2.name, rbacContext, itemStore.MailboxOwner.MailboxInfo.OrganizationId.ToString());
                        DiscoverySearchEventBasedAssistant.RpcCallWithRetry(delegate()
                        {
                            client.StartEx(searchId, rbacContext);
                        });
                        SearchEventLogger.Instance.LogDiscoverySearchStartRequestProcessedEvent(CS$ < > 8__locals2.name, rbacContext, itemStore.MailboxOwner.MailboxInfo.OrganizationId.ToString());
                    });
                    break;

                case ActionRequestType.Delete:
                    this.CallSearchService(itemStore, CS$ < > 8__locals2.name, null, delegate(MailboxSearchClient client, SearchId searchId)
                    {
                        DiscoverySearchEventBasedAssistant.RpcCallWithRetry(delegate()
                        {
                            client.Remove(searchId, true);
                        });
                    });
                    SearchEventLogger.Instance.LogDiscoverySearchRemoveRequestProcessedEvent(CS$ < > 8__locals2.name, rbacContext, itemStore.MailboxOwner.MailboxInfo.OrganizationId.ToString());
                    break;

                case ActionRequestType.UpdateStatus:
                    this.CallSearchService(itemStore, CS$ < > 8__locals2.name, null, delegate(MailboxSearchClient client, SearchId searchId)
                    {
                        DiscoverySearchEventBasedAssistant.RpcCallWithRetry(delegate()
                        {
                            client.UpdateStatus(searchId);
                        });
                    });
                    break;
                }
                try
                {
                    itemStore.Delete(DeleteItemFlags.HardDelete, new StoreId[]
                    {
                        item.Id
                    });
                    return;
                }
                catch (StoragePermanentException ex)
                {
                    DiscoverySearchEventBasedAssistant.Tracer.TraceError <string, StoragePermanentException>((long)this.GetHashCode(), "Failed to remove mailbox discovery search request item. Name: '{0}'. Exception: '{1}'", CS$ < > 8__locals2.name, ex);
                    SearchEventLogger.Instance.LogDiscoverySearchServerErrorEvent("Failed to remove mailbox discovery search request item", CS$ < > 8__locals2.name, itemStore.ServerFullyQualifiedDomainName, ex);
                    return;
                }
                catch (StorageTransientException ex2)
                {
                    DiscoverySearchEventBasedAssistant.Tracer.TraceError <string, StorageTransientException>((long)this.GetHashCode(), "Failed to remove mailbox discovery search request item. Name: '{0}'. Exception: '{1}'", CS$ < > 8__locals2.name, ex2);
                    SearchEventLogger.Instance.LogDiscoverySearchServerErrorEvent("Failed to remove mailbox discovery search request item", CS$ < > 8__locals2.name, itemStore.ServerFullyQualifiedDomainName, ex2);
                    return;
                }
            }
            DiscoverySearchEventBasedAssistant.Tracer.TraceDebug <string>((long)this.GetHashCode(), "Skipping discovery search object from non-arbitration mailbox: {0}", itemStore.MailboxOwnerLegacyDN);
        }
 // Token: 0x06001395 RID: 5013 RVA: 0x00072DF0 File Offset: 0x00070FF0
 private static void RpcCallWithRetry(Action rpcDelegate)
 {
     DiscoverySearchEventBasedAssistant.RpcCallWithRetry(rpcDelegate, 3);
 }