handle unique constraints on entities