public static async Task <bool> CognitoUserPoolDomainExists( this AmazonCognitoIdentityProviderClient client, string name) { try { var response = await client.DescribeUserPoolDomainAsync(new DescribeUserPoolDomainRequest { Domain = name }); return(!string.IsNullOrEmpty(response.DomainDescription?.UserPoolId)); } catch (Amazon.CognitoIdentityProvider.Model.ResourceNotFoundException) { return(false); } }