Refactor serialization to support later implementation of partial record saving.