Refactoring code. Moving methods to BaseController