move creation of posts to a helper method