Added more robust uniqueness IntegrityError checking