Move all interactions with the database to pygd