code: function indexWithDescendants(items, index) {
    items.forEach(function(item) {
      item.allShareKeys.forEach(function(key) {
        var insertionKey = key;
  
        if (index[insertionKey]) {
          insertionKey = generateUniqueKey(index, key);
  
          if (item.uniqueId === key) {
            // If this duplicate was the item's main key that will be used for sharing it in general, set this
            // to the new key. This means that sharing the item will still work most of the time.
            item.id = insertionKey;
          }
  
          console.warn(
            "Duplicate shareKey: " +
              key +
              ". Inserting new item under " +
              insertionKey
          );
        }
  
        index[insertionKey] = item;
      }, this);
  
      if (defined(item.items)) {
        indexWithDescendants(item.items, index);
      }
    });
  }
docs: Adds all passed items to the passed index, and all the children of those items recursively.
  @private
  @param {CatalogMember[]} items
  @param {Object} index