public static BadRequestObjectResult AsBadRequest(this ValidationResult validationResult) { if (validationResult.IsValid) { return(null); } return(new BadRequestObjectResult(validationResult.AsModelStateDictionary())); }