added validation to post controller