Refactor postData method to helper class