use session pattern to have better control of db connection