private async Task <string> Process(global::Shared.CommandDto command)
        {
            _logger.LogInformation("Received {Type}", command.Type);

            try
            {
                var result = Domain.processCommand(_state, command);

                _logger.LogInformation("Processed ok: {IsOk}", result.IsOk);

                if (result.IsOk)
                {
                    var(newState, eventDto) = result.ResultValue;
                    await _eventRepository.Save(eventDto);

                    await _stateRepository.Set(newState);

                    _state = newState;
                    _logger.LogInformation("Updated state");
                }

                return(result.IsOk ? result.ResultValue.Item2.Id.ToString() : result.ErrorValue);
            }
            catch (Exception e)
            {
                _logger.LogError(e.ToString());
                return(e.Message);
            }
        }
        public async Task Replies_Ok()
        {
            var postbox     = new CommandPostbox();
            var command     = new CommandDto("123", "");
            var postTask    = postbox.Post(command);
            var tokenSource = new CancellationTokenSource();

            async Task <string> Process()
            {
                await foreach (var(c, reply) in postbox.Read(tokenSource.Token))
                {
                    reply(c.Type);
                    return(c.Body);
                }

                return("");
            }

            var results = await Task.WhenAll(postTask, Process());

            Assert.Equal("123", results[0]);
        }