public async Task <IActionResult> Execute(JObject jObj, string subject, string commonId) { if (jObj == null) { throw new ArgumentNullException(nameof(jObj)); } if (string.IsNullOrWhiteSpace(subject)) { throw new ArgumentNullException(nameof(subject)); } AddDiscountCommand command = null; try { command = _requestBuilder.GetAddDiscountCommand(jObj); } catch (ArgumentException ex) { var error = _responseBuilder.GetError(ErrorCodes.Request, ex.Message); return(_controllerHelper.BuildResponse(HttpStatusCode.BadRequest, error)); } var validationResult = await _validator.Validate(command, subject); if (!validationResult.IsValid) { var error = _responseBuilder.GetError(ErrorCodes.Request, validationResult.Message); return(_controllerHelper.BuildResponse(HttpStatusCode.BadRequest, error)); } command.CommonId = commonId; command.Subject = subject; _commandSender.Send(command); return(new OkResult()); }