Improve serialization of structs sent over the wire like CastMessage, CastMessageEnvelope, MessageEnvelope, and PythonMessage