remove duplicates from collection before insert