serialization for the messages