Update validateUniqueness to support custom primaryKeys.