Refactor bin/dendrite to be more ORM-ish