I am facing one issue that even if Duplicate Rule is defined on the Contact Object still I am able to insert duplicate Contact records in bulk from apex. This is because the contacts which I am trying to insert thru Apex that same contact is not yet present in Salesforce, so when I try inserting the multiple Contacts with same information thru apex it will not error out. Once contacts are inserted in SF and now if I try to insert duplicates , apex will error out saying there is already a Duplicate Contact created.
Is there a way to check if the list of Contact records already contain Duplicate Contacts based on Duplicate Rule defined?