public static async Task Run()
        {
            var appender = new MemoryAppendStoreAsync();
            IEventStoreAsync es = new EventStoreAsync(appender);

            IDtoConverter<SayingDto, Saying> converter = new MyDtoConverters();
            Stream mem = System.IO.File.Open("test.json", FileMode.OpenOrCreate, FileAccess.ReadWrite);

            IDtoSerializer<SayingDto> dtoSerializer = new FastJsonSerializer<SayingDto>(mem);
            ITableReaderWriter<Saying> said = new TableWriterForSerializer<Saying, SayingDto>(new MemoryHashTableWriter<Saying>(), converter, dtoSerializer);

            IAsyncProjection projection = new ConsoleProjection(new AsyncProjectFromImplementation(new SayingHistoryProjection(said)));

            IEventStoreAsync es2 = new EventStoreAsyncPublisher(es, projection);


            //IAsyncCommandDispatcher dispatcher = new ConsoleLoggerDispatcher(new CompositeAsyncCommandDispatcher(new SaySomething(es2)));
            ICommandHandler handler = new SaySomething(es2);

            await handler.GetExecutor(new SayCommand()
            {
                PersonId = new PersonId(1),
                Say = "Say hello",
                Timestamp = DateTime.UtcNow
            }).Execute();

            foreach (var saying in said.GetAll().Result)
            {
                Console.Write("Entry in projection:\t\t");
                Console.WriteLine("{0} said: {1}", saying.PersonId, saying.Said);
            }
        }
        private void OnServerHandshakeFrame(object source, HandshakeFrameReceivedEventArgs e)
        {
            if (_state != ClientState.ServerToClientHandshake)
            {
                throw new Exception("Server handshake should not be received during " + _state);
            }
            var frame = _extensionService.ClientConfirmExtensions(e.Handshake, _connection.Identity);

            _state = ClientState.Ready;
            _connection.SetHandshakeCompleted();
            _connection.Send(frame);


            var name = _extensionService.FindFirstExtensionNamed("json", "xml", "protobuf");

            switch (name)
            {
            case "json":
                _payloadSerializer = new FastJsonSerializer();
                break;
            }

            _ackExtensionId = _extensionService.FindFirstExtensionId("batch-ack", "ack");
            if (_ackExtensionId != 0)
            {
                name = _extensionService.FindFirstExtensionNamed("batch-ack", "ack");
                var extProperties = frame.GetExtension(name);
                var ackExtension  = (IAckExtension)_extensionService.Get(_ackExtensionId);
                _ackReceiver = ackExtension.CreateAckReceiver(_connection, _ackExtensionId, DeliverMessage,
                                                              extProperties);
                _ackSender = ackExtension.CreateAckSender(_connection, _ackExtensionId, extProperties);
            }


            _authenticationEvent.Set();
        }