public async Task <CreateBoxRequest.Response> Handle(CreateBoxRequest request, CancellationToken cancellationToken) { var boxId = BoxId.ForBarcode(request.Barcode); var command = new CreateBoxCommand(boxId, new Barcode(request.Barcode)); var result = await _mediator.Send(command, cancellationToken).ConfigureAwait(false); if (result.IsOk) { return(new CreateBoxRequest.Response(true, null, boxId.Value)); } var failureMessage = string.Join("\r\n", result.FailedWith()); return(new CreateBoxRequest.Response(false, failureMessage, null)); }