public TenantDomains AddTenantDomain(TenantDomain tenantDomain, bool setupLocalUrls, bool secureUrls) { ValidateTenant(tenantDomain.TenantUid); var tenantHome = nodeHelper.GetTenantRoot(tenantDomain.TenantUid); string domainList = nodeHelper.GetTenantDomainsString(tenantDomain.TenantUid); if (tenantDomain.isPrimary) { nodeHelper.SetNodeContent(tenantHome, "domain", tenantDomain.Domain, false); nodeHelper.SaveNode(tenantHome); languageDictionaryService.AddCultureAndHostnameDomain(tenantDomain, secureUrls); nodeHelper.TryPublishSite(tenantHome.Id); return(nodeHelper.GetTenantDomains(tenantDomain.TenantUid)); } if (DomainAlreadyExists(tenantDomain.TenantUid, tenantDomain.Domain)) { throw new TenantException(ExceptionCode.DomainAlreadyAssigned.CodeToString(), ExceptionCode.DomainAlreadyAssigned, tenantDomain.TenantUid, tenantDomain.Domain); } domainList += string.IsNullOrEmpty(domainList) ? tenantDomain.Domain : $",{tenantDomain.Domain}"; nodeHelper.SetNodeContent(tenantHome, "alternateDomains", domainList, false); nodeHelper.SaveNode(tenantHome); languageDictionaryService.AddCultureAndHostnameDomain(tenantDomain, secureUrls); nodeHelper.TryPublishSite(tenantHome.Id); return(nodeHelper.GetTenantDomains(tenantDomain.TenantUid)); }