Save/load loading state to/from SQLite3 database