Added checks to see if this is a create post or update post