added validation to post model