public byte[] BinarySerializeMessage <T>(IMessage <T> message) where T : class, IPayload { message.ComplementHeader(); using var memoryStream = new MemoryStream(); _binSerializer.Serialize(memoryStream, message); return(memoryStream.ToArray()); }