factor out rethinkdb session