Refactor view controller to adapt dbManager