split out the serialization of records and recordsets into their own classes