abstracted db serialization