Extract post /tasks code to helper method