Small refactoring before implementing service in groovy