private void startGroupDetailsService(Recipient recipient) {

    String id = recipient.getId();
    String smartPagerId = recipient.getSmartPagerId();
    String name = recipient.getName();

    ((BaseActivity) getActivity()).showProgressDialog(getActivity().getString(R.string.processing));
    Bundle extras = new Bundle();
    extras.putString(WebSendParam.groupId.name(), id);
    extras.putString(GroupDetails.name.name(), name);
    extras.putString(GroupContactItem.contact_smart_pager_id_or_group_id.name(), smartPagerId);
    SmartPagerApplication.getInstance().startWebAction(WebAction.getPagingGroupDetails, extras);
  }
  private void startContactDetails(Recipient recipient) {

    String id = recipient.getId();
    String smartPagerId = recipient.getSmartPagerId();

    Intent intent =
        new Intent(
            SmartPagerApplication.getInstance().getApplicationContext(),
            ContactDetailsActivity.class);
    intent.putExtra(GroupContactItem.id.name(), id);
    intent.putExtra(GroupContactItem.contact_smart_pager_id_or_group_id.name(), smartPagerId);
    startActivity(intent);
  }
  private void startGroupDetails(Recipient recipient) {

    String groupType = recipient.getGroupType();

    if (groupType.equalsIgnoreCase(LocalGroupDetailsActivity.LOCAL)) {
      startLocalGroupDetails(recipient);
    } else {
      startGroupDetailsService(recipient);
    }
  }
  private LinkedHashMap<String, List<IHolderSource>> getIndexableContactsList(Cursor cursor) {
    String[] sectionTitles = {
      "Favorites",
      "Groups",
      "#",
      "A",
      "B",
      "C",
      "D",
      "E",
      "F",
      "G",
      "H",
      "I",
      "J",
      "K",
      "L",
      "M",
      "N",
      "O",
      "P",
      "Q",
      "R",
      "S",
      "T",
      "U",
      "V",
      "W",
      "X",
      "Y",
      "Z"
    };
    LinkedHashMap<String, List<IHolderSource>> tableDataMap =
        new LinkedHashMap<String, List<IHolderSource>>();
    for (String title : sectionTitles) {
      tableDataMap.put(title, new ArrayList<IHolderSource>());
    }

    if (cursor.moveToFirst()) {
      do {
        Recipient recipient = Recipient.createFromDepartmentCursor(cursor);
        // Don't add currently logged in user as a contact
        if (recipient
            .getSmartPagerId()
            .equalsIgnoreCase(
                SmartPagerApplication.getInstance().getPreferences().getSmartPagerID())) continue;

        if (recipient.isGroup()) {
          tableDataMap.get("Groups").add(recipient);
        } else {
          // trim() to account for any last names that have a leading space
          String firstChar = recipient.getLastName().trim().substring(0, 1).toUpperCase();
          if (Arrays.asList(sectionTitles).contains(firstChar)) {
            tableDataMap.get(firstChar).add(recipient);
          }
        }

        if (SmartPagerApplication.getInstance()
            .isFavourite(getActivity().getApplicationContext(), recipient.getSmartPagerId())) {
          tableDataMap.get("Favorites").add(recipient);
        }

        if (recipient.getGroupType().equalsIgnoreCase("LOCAL")) {
          tableDataMap.get("Favorites").add(recipient);
        }

      } while (cursor.moveToNext());
    }

    // Only sort Favorites and Groups, the rest of the sections appear to sort properly.
    Collections.sort(tableDataMap.get("Favorites"), new RecipientsGroupsComparator());
    Collections.sort(tableDataMap.get("Groups"), new RecipientsGroupsComparator());

    return tableDataMap;
  }