Very close to first implementation of sqlite3 session storage