private static void ThrowValidationException(TResponse response) { var exception = new DomainException("Error"); if (response.Errors == null) { return; } foreach (string error in response.Errors) { exception.AddDomainError(string.Empty, error, string.Empty, string.Empty); } throw exception; }