Cleaner code for db session handling