private static TcpPackage WrapReadEventsCompleted(ClientMessage.ReadEventCompleted msg)
 {
     var dto = new TcpClientMessageDto.ReadEventCompleted(msg.EventStreamId,
                                                       msg.EventNumber,
                                                       (int)msg.Result,
                                                       msg.Record == null ? null : msg.Record.EventType,
                                                       msg.Record == null ? null : msg.Record.Data,
                                                       msg.Record == null ? null : msg.Record.Metadata,
                                                       msg.Record == null ? -1 : msg.Record.LogPosition);
     return new TcpPackage(TcpCommand.ReadEventCompleted, msg.CorrelationId, dto.Serialize());
 }
 private static TcpPackage WrapReadEventCompleted(ClientMessage.ReadEventCompleted msg)
 {
     var dto = new TcpClientMessageDto.ReadEventCompleted(
         (TcpClientMessageDto.ReadEventCompleted.ReadEventResult) msg.Result,
         new TcpClientMessageDto.ResolvedIndexedEvent(msg.Record.Event, msg.Record.Link), msg.Error);
     return new TcpPackage(TcpCommand.ReadEventCompleted, msg.CorrelationId, dto.Serialize());
 }