public static OrganizationId OrgIdFromPublishingLicenseOrDefault(string publishingLicense, OrganizationId defaultOrgId, out Guid externalDirectoryOrgId)
        {
            ArgumentValidator.ThrowIfNullOrEmpty("publishingLicense", publishingLicense);
            ArgumentValidator.ThrowIfNull("defaultOrgId", defaultOrgId);
            externalDirectoryOrgId = Guid.Empty;
            Guid guid;

            if (!RmsClientManagerUtils.ExtractExternalOrgIdFromPublishingLicense(publishingLicense, out guid))
            {
                return(defaultOrgId);
            }
            Guid b;

            if (!RmsClientManager.IRMConfig.GetTenantExternalDirectoryOrgId(defaultOrgId, out b))
            {
                return(defaultOrgId);
            }
            if (guid == b)
            {
                return(defaultOrgId);
            }
            OrganizationId result;

            if (ADOperationResult.Success == RmsClientManagerUtils.TryGetOrganizationIdFromExternalDirectoryOrgId(guid, out result))
            {
                externalDirectoryOrgId = guid;
                return(result);
            }
            return(defaultOrgId);
        }