public IActionResult ConvertToCsv([FromBody] TextWebModel textWebModel)
        {
            if (string.IsNullOrWhiteSpace(textWebModel.Content) || !textWebModel.IsValid())
            {
                return(BadRequest(new { error = "This field can contain letters, digits, comma and dot characters and can't be empty" }));
            }

            var result = _convertService.ConvertToCsv(textWebModel.Content);

            if (result.Failure)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError,
                                  new { error = result.Error }));
            }

            return(Ok(new TextWebModel {
                Content = result.Value
            }));
        }
 public static bool IsValid(this TextWebModel model)
 {
     return(Regex.IsMatch(model.Content.Trim(), @"^[a-zA-Z0-9]+[a-zA-Z0-9,.\s\r\n]*$"));
 }