Refactor post.groovy