Implement serialize / unserialize