(de)serialization of database