factor out Database#persist