public async Task HandleAsync(SubmitRemarkVote command) { await _handler .Run(async() => await _remarkService.SubmitVoteAsync(command.RemarkId, command.UserId, command.Positive, command.CreatedAt)) .OnSuccess(async() => await _bus.PublishAsync(new RemarkVoteSubmitted(command.Request.Id, command.UserId, command.RemarkId, command.Positive, command.CreatedAt))) .OnCustomError(ex => _bus.PublishAsync(new SubmitRemarkVoteRejected(command.Request.Id, command.UserId, command.RemarkId, ex.Code, ex.Message))) .OnError(async(ex, logger) => { logger.Error(ex, "Error occured while submitting a remark vote."); await _bus.PublishAsync(new SubmitRemarkVoteRejected(command.Request.Id, command.UserId, command.RemarkId, OperationCodes.Error, ex.Message)); }) .ExecuteAsync(); }