Add ToUnique functionality to prevent duplication of entity objects