@Override
 public int getCount() {
   int count = 0;
   for (int i = 0; i < sections.size(); i++) {
     ListSectionProxy section = sections.get(i);
     count += section.getItemCount();
   }
   return count;
 }
  protected Pair<ListSectionProxy, Pair<Integer, Integer>> getSectionInfoByEntryIndex(int index) {
    if (index < 0) {
      return null;
    }
    for (int i = 0; i < sections.size(); i++) {
      ListSectionProxy section = sections.get(i);
      int sectionItemCount = section.getItemCount();
      if (index <= sectionItemCount - 1) {
        return new Pair<ListSectionProxy, Pair<Integer, Integer>>(
            section, new Pair<Integer, Integer>(i, index));
      } else {
        index -= sectionItemCount;
      }
    }

    return null;
  }
 private int findItemPosition(int sectionIndex, int sectionItemIndex) {
   int position = 0;
   for (int i = 0; i < sections.size(); i++) {
     ListSectionProxy section = sections.get(i);
     if (i == sectionIndex) {
       if (sectionItemIndex >= section.getContentCount()) {
         Log.e(TAG, "Invalid item index");
         return -1;
       }
       position += sectionItemIndex;
       if (section.getHeaderTitle() != null) {
         position += 1;
       }
       break;
     } else {
       position += section.getItemCount();
     }
   }
   return position;
 }