code: @UiThread
      int getNearestParentPosition(int flatPosition) {
          if (flatPosition == 0) {
              return 0;
          }
  
          int parentCount = -1;
          for (int i = 0; i <= flatPosition; i++) {
              ExpandableWrapper<P, C> listItem = mFlatItemList.get(i);
              if (listItem.isParent()) {
                  parentCount++;
              }
          }
          return parentCount;
      }
docs: Given the index relative to the entire RecyclerView, returns the nearest
  ParentPosition without going past the given index.
  <p>
  If it is the index of a parent, will return the corresponding parent position.
  If it is the index of a child within the RV, will return the position of that child's parent.