Centralize binary serialization for better reuse