Duplicate records being created

I'm not able to find anything online about this issue, but when I create records in my application, I first do a check to see if they're on here, and if they are, it skips the step to create the record here. For instance, I created a purchase invoice and it recreated the supplier that it was associated with by the contact_id. They are two separate records in the sage database, one has 0.0 money owed, and the second has the amount from the purchase invoice as it's money owned. But they are the same contact/supplier. I'm referencing everything by the id, which I assumed was unique. I'm at a loss as to why this did not trigger a unique validation issue