created function to remove duplicate posts