refactor create action in post controller