added validation to posts model