Add support for serializing PersistentState to a save file