public byte[] EncodeMessage<T>(T message)
        {
            if (message == null)
                throw new CannotSerializeMessageException("The message which is to be serialized cannot be null.");

            var raw = ProtocolBuffersConvert.SerializeObject<T>(message);
            if (CompressionEnabled)
            {
                return GZipCompression.Compress(raw);
            }
            else
            {
                return raw;
            }
        }