removed duplicate code to base controller