refactoring of base controllers to remove duplicate code