public byte[] Serialize(FrontendMessage message)
        {
            var messageTypeId = message.GetType().GetField("MessageTypeId")?.GetValue(message);
            var payload       = message.Serialize();

            var buffer = new List <byte>();

            if (messageTypeId != null)
            {
                buffer.Add((byte)messageTypeId);
            }
            buffer.AddRange(SerializerCore.Serialize(payload.Length + sizeof(int)));
            buffer.AddRange(payload);

            return(buffer.ToArray());
        }
        public void Write(string value)
        {
            var buffer = SerializerCore.Serialize(value);

            base.Write(buffer, 0, buffer.Length);
        }