Move symref logic into repo module, not in db interface