// Token: 0x06000329 RID: 809 RVA: 0x00011358 File Offset: 0x0000F558
        private static TenantPartitionCacheItem FindTenantInfoByExternalOrgId(Guid externalOrgId)
        {
            TenantPartitionCacheItem tenantPartitionCacheItem = null;

            if (externalOrgId == TemplateTenantConfiguration.TemplateTenantExternalDirectoryOrganizationIdGuid)
            {
                ExchangeConfigurationUnit localTemplateTenant = TemplateTenantConfiguration.GetLocalTemplateTenant();
                if (localTemplateTenant != null)
                {
                    ExTraceGlobals.GLSTracer.TraceDebug <string>(0L, "FindTenantInfoByExternalOrgId() asked for Consumer Template tenant, returning {0}", localTemplateTenant.Id.Parent.DistinguishedName);
                    string name = localTemplateTenant.Id.Parent.Name;
                    tenantPartitionCacheItem = new TenantPartitionCacheItem(Guid.Empty, localTemplateTenant.OrganizationId.PartitionId.ForestFQDN, PartitionId.LocalForest.ForestFQDN, externalOrgId, name, false);
                }
                return(tenantPartitionCacheItem);
            }
            PartitionId partitionId;

            if (!ADSessionSettings.IsGlsDisabled)
            {
                if (ADAccountPartitionLocator.TryLookUpAccountForest(externalOrgId, null, null, out tenantPartitionCacheItem))
                {
                    return(tenantPartitionCacheItem);
                }
            }
            else if (ADAccountPartitionLocator.IsSingleForestTopology(out partitionId))
            {
                ExTraceGlobals.GLSTracer.TraceDebug <Guid>(0L, "GLS is disabled, performing the only partition lookup for {0}", externalOrgId);
                return(ADAccountPartitionLocator.SearchForTenantInfoByExternalOrgId(externalOrgId, partitionId));
            }
            if (GlsMServDirectorySession.ShouldScanAllForests)
            {
                ADAccountPartitionLocator.LoadPartitionCacheIfNecessary();
                PartitionId[] array = ADAccountPartitionLocator.allAccountPartitionIds;
                foreach (PartitionId partitionId2 in array)
                {
                    tenantPartitionCacheItem = ADAccountPartitionLocator.SearchForTenantInfoByExternalOrgId(externalOrgId, partitionId2);
                    if (tenantPartitionCacheItem != null)
                    {
                        ADAccountPartitionLocator.InsertCacheMaps(tenantPartitionCacheItem, null, null);
                        return(tenantPartitionCacheItem);
                    }
                }
            }
            return(null);
        }