public static void DeleteSubdomainForService(DnsProvider dnsProvider, Service service)
        {
            var zone       = dnsProvider.GetZone(service.Variables["SD-ZoneId"].ToString(), ZoneSearchType.Id);
            var domainName = Globals.DomainParser.Get(service.Variables["SD-FullSubDomain"].ToString());
            var removed    = dnsProvider.RemoveZone(zone, domainName.SubDomain);

            if (removed)
            {
                using (var securityBypass = new SecurityBypass(service))
                {
                    service.Variables.RemoveValue("SD-FullSubDomain");
                    service.Variables.RemoveValue("SD-ZoneId");
                    service.Variables.RemoveValue("SD-DnsProvider");
                    service.Save();
                }

                return;
            }

            throw new SubdomainException($"Failed to delete <strong>{domainName.Hostname}</strong> subdomain.");
        }
        public static void CreateSubdomainForService(DnsProvider dnsProvider, Service service, string subdomain,
                                                     string baseDomain)
        {
            subdomain = ParseSubdomain(subdomain);
            if (IsIllegal(subdomain))
            {
                throw new SubdomainException($"<strong>Illegal Subdomain - {subdomain}</strong>");
            }

            if (!dnsProvider.ZoneExists(baseDomain, ZoneSearchType.Id))
            {
                throw new SubdomainException($"<strong>Invalid Zone</strong>");
            }

            var zone = dnsProvider.GetZone(baseDomain, ZoneSearchType.Id);

            if (!dnsProvider.SubdomainAvailable(zone, subdomain))
            {
                throw new SubdomainException($"<strong>{subdomain}.{zone.Name}</strong> is already taken!");
            }

            var created = dnsProvider.AddZone(zone, subdomain, service.PublicIpAddress);

            if (created)
            {
                using (var securityBypass = new SecurityBypass(service))
                {
                    service.Variables["SD-FullSubDomain"] = $"{subdomain}.{zone.Name}";
                    service.Variables["SD-ZoneId"]        = $"{zone.Id}";
                    service.Variables["SD-DnsProvider"]   = dnsProvider.DnsProviderType.DnsProviderId;
                    service.Save();
                }

                return;
            }

            throw new SubdomainException($"Failed to create <strong>{subdomain}.{zone.Name}</strong> subdomain.");
        }