private TcpPackage WrapSubscribeReplica(ReplicationMessage.SubscribeReplica msg)
        {
            var epochs = msg.LastEpochs.Select(x => new ReplicationMessageDto.Epoch(x.EpochPosition, x.EpochNumber, x.EpochId.ToByteArray())).ToArray();
            var dto    = new ReplicationMessageDto.SubscribeReplica(msg.LogPosition,
                                                                    msg.ChunkId.ToByteArray(),
                                                                    epochs,
                                                                    msg.ReplicaEndPoint.Address.GetAddressBytes(),
                                                                    msg.ReplicaEndPoint.Port,
                                                                    msg.MasterId.ToByteArray(),
                                                                    msg.SubscriptionId.ToByteArray(),
                                                                    msg.IsPromotable);

            return(new TcpPackage(TcpCommand.SubscribeReplica, Guid.NewGuid(), dto.Serialize()));
        }
        private TcpPackage WrapSubscribeReplica(ReplicationMessage.SubscribeReplica msg)
        {
            var epochs = msg.LastEpochs.Select(x =>
                                               new Epoch(x.EpochPosition, x.EpochNumber, x.EpochId.ToByteArray())).ToArray();
            var dto = new SubscribeReplica(msg.LogPosition,
                                           msg.ChunkId.ToByteArray(),
                                           epochs,
                                           Helper.UTF8NoBom.GetBytes(msg.ReplicaEndPoint.GetHost()),
                                           msg.ReplicaEndPoint.GetPort(),
                                           msg.LeaderId.ToByteArray(),
                                           msg.SubscriptionId.ToByteArray(),
                                           msg.IsPromotable);

            return(new TcpPackage(TcpCommand.SubscribeReplica, Guid.NewGuid(), dto.Serialize()));
        }