eagerPair(relationName, related, parentModels, options) {
      // If this is a morphTo, we only want to pair on the morphValue for the current relation.
      if (this.type === 'morphTo') {
        parentModels = _.filter(parentModels, (m) => {
          return m.get(this.key('morphKey')) === this.key('morphValue');
        });
      }

      // If this is a `through` or `belongsToMany` relation, we need to cleanup and setup the
      // `interim` model.
      if (this.isJoined()) related = this.parsePivot(related);

      // Group all of the related models for easier association with their parent models.
      const idKey = (key) => (_.isBuffer(key) ? key.toString('hex') : key);
      const grouped = _.groupBy(related, (m) => {
        let key;
        if (m.pivot) {
          if (this.isInverse() && this.isThrough()) {
            key = this.isThroughForeignKeyTargeted() ? m.pivot.get(this.throughForeignKeyTarget) : m.pivot.id;
          } else {
            key = m.pivot.get(this.key('foreignKey'));
          }
        } else if (this.isInverse()) {
          key = this.isForeignKeyTargeted() ? m.get(this.foreignKeyTarget) : m.id;
        } else {
          key = m.get(this.key('foreignKey'));
        }
        return idKey(key);
      });

      // Loop over the `parentModels` and attach the grouped sub-models, keeping the `relatedData`
      // on the new related instance.
      _.each(parentModels, (model) => {
        let groupedKey;
        if (!this.isInverse()) {
          const parsedKey = Object.keys(model.parse({[this.parentIdAttribute]: null}))[0];
          groupedKey = idKey(model.get(parsedKey));
        } else {
          const keyColumn = this.key(this.isThrough() ? 'throughForeignKey' : 'foreignKey');
          const formatted = model.format(_.clone(model.attributes));
          groupedKey = idKey(formatted[keyColumn]);
        }
        if (groupedKey != null) {
          const relation = (model.relations[relationName] = this.relatedInstance(grouped[groupedKey], options));
          if (this.type === 'belongsToMany') {
            // If type is `belongsToMany` then the relatedData needs to be recreated through the
            // parent model
            relation.relatedData = model[relationName]().relatedData;
          } else {
            relation.relatedData = this;
          }
          if (this.isJoined()) _.extend(relation, PivotHelpers);
        }
      });

      // Now that related models have been successfully paired, update each with its parsed
      // attributes
      related.map((model) => {
        model.attributes = model.parse(model.attributes);
        model.formatTimestamps()._previousAttributes = _.cloneDeep(model.attributes);
        model._reset();
      });

      return related;
    }
Groups the eagerly loaded relations according to the type of relationship we're handling for
easy attachment to the parent models.

@param {string} relationName The relation name being paired to its parent models.
@param {Model[]} related The related models obtained from the eager load fetch call.
@param {Model[]} parentModels The parent models of the eager fetched relation.
@param {options} options Eager fetch query options.
@return {Model[]} The eager fetch models.