CLOUDSRV-2959 & NODEJS-1103 fix the session bug which had been saved by the sdk and add a generic method.

These two issues have to do together.