private static void LicenseToDB(License license)
        {
            Validate(license);

            CustomerId = license.CustomerId;

            var defaultQuota = CoreContext.TenantManager.GetTenantQuota(Tenant.DEFAULT_TENANT);

            var quota = new TenantQuota(-1000)
            {
                ActiveUsers    = license.ActiveUsers,
                MaxFileSize    = defaultQuota.MaxFileSize,
                MaxTotalSize   = defaultQuota.MaxTotalSize,
                Name           = "license",
                DocsEdition    = true,
                HasDomain      = true,
                Audit          = true,
                ControlPanel   = true,
                HealthCheck    = true,
                Ldap           = true,
                Sso            = true,
                Customization  = license.Customization,
                WhiteLabel     = license.WhiteLabel || license.Customization,
                Branding       = license.Branding,
                SSBranding     = license.SSBranding,
                Update         = true,
                Support        = true,
                Trial          = license.Trial,
                CountPortals   = license.PortalCount,
                DiscEncryption = true,
                PrivacyRoom    = true,
                Restore        = true,
                ContentSearch  = true
            };

            if (defaultQuota.Name != "overdue" && !defaultQuota.Trial)
            {
                quota.WhiteLabel |= defaultQuota.WhiteLabel;
                quota.Branding   |= defaultQuota.Branding;
                quota.SSBranding |= defaultQuota.SSBranding;

                quota.CountPortals = Math.Max(defaultQuota.CountPortals, quota.CountPortals);
            }

            CoreContext.TenantManager.SaveTenantQuota(quota);

            var tariff = new Tariff
            {
                QuotaId = quota.Id,
                DueDate = license.DueDate,
            };

            CoreContext.PaymentManager.SetTariff(-1, tariff);

            if (!string.IsNullOrEmpty(license.AffiliateId))
            {
                var tenant = CoreContext.TenantManager.GetCurrentTenant();
                tenant.AffiliateId = license.AffiliateId;
                CoreContext.TenantManager.SaveTenant(tenant);
            }
        }