Elminate some duplication in Message serialization.