Implemented efficient way to remove the post in the array