Move database reset logic into controller.