private void AddDnsRecord(string zoneId, string name, string value)
{
HttpClient client = new HttpClient();
var request = CreateRequest(HttpMethod.Post, string.Format(CreateRecordUrl, zoneId));
request.Content = new StringContent(
$"{{\"type\": \"TXT\", \"name\": \"{name}\", \"content\": \"{value}\"}}");
request.Content.Headers.ContentType.MediaType = "application/json";
var result = client.SendAsync(request).GetAwaiter().GetResult();
if (!result.IsSuccessStatusCode)
{
throw new Exception($"Could not add dns record {name} to zone {zoneId}. Result: {result.StatusCode} - {result.Content.ReadAsStringAsync().GetAwaiter().GetResult()}");
}
}