moved session id logic into model