Finished adding persistence by serializing the data structures.