This reverts commit 8b6b9453a8f86d705ec2319c51f429faf687cb52.
Decoupling this from the DB, it's a good step. Not yet perfect however.