Persist session to the database