code: function sortMainFirst(main) {
    return (entity1, entity2) => {
      if (entity1.key === main.key) {
        return -1;
      }
      else if (entity2.key === main.key) {
        return 1;
      }
      return 0;
    };
  }
docs: We try to dispatch the actions of the orignal entities (the ones which schema was passed) first