Replace manual db operations with SugarORM