void SendMessageWithStream(MessageSerializer messageSerializer, Stream stream, Message message)
 {
     //Clear the serializer
     messageSerializer.Clear();
     //Prepare the data to send.
     messageSerializer.Write(TopicName);
     messageSerializer.SerializeMessageWithLength(message);
     //Send via the stream.
     messageSerializer.SendTo(stream);
 }