GRAILS-10509 - fix compilation problem with abstract methods in controllers
refactor some logic into a helper method