public TenantDomains RemoveTenantDomain(TenantDomain tenantDomain, bool secureUrls) { ValidateTenant(tenantDomain.TenantUid); var tenantHome = nodeHelper.GetTenantRoot(tenantDomain.TenantUid); var domains = nodeHelper.GetTenantDomains(tenantDomain.TenantUid); if (domains.AlternateDomains == null) { throw new TenantException(ExceptionCode.DomainDoesNotExist.CodeToString(), ExceptionCode.DomainDoesNotExist, tenantDomain.TenantUid, tenantDomain.Domain); } if (domains.AlternateDomains.SingleOrDefault(x => x == tenantDomain.Domain) == null) { throw new TenantException(ExceptionCode.DomainDoesNotExist.CodeToString(), ExceptionCode.DomainDoesNotExist, tenantDomain.TenantUid, tenantDomain.Domain); } var domainList = nodeHelper.GetTenantDomainsString(tenantDomain.TenantUid); domainList = domainList.Replace($"{tenantDomain.Domain}", string.Empty); var array = domainList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); domainList = string.Join(",", array); nodeHelper.SetNodeContent(tenantHome, "alternateDomains", domainList, false); nodeHelper.SaveNode(tenantHome); languageDictionaryService.RemoveCultureAndHostname(tenantDomain, secureUrls); nodeHelper.TryPublishSite(tenantHome.Id); return(nodeHelper.GetTenantDomains(tenantDomain.TenantUid)); }