Revert "Cleaner code for db session handling"

This reverts commit 424c90c021af7575e35ae3f8c024306396b2ea11.