Modified the logic to update the post