reworked API to move session to DB