/**
  * Add the given {@link GroupDelta} internally, filing based on its {@link
  * GroupDelta#getShouldSync()} status.
  */
 private void addGroup(GroupDelta group) {
   if (group.getShouldSync()) {
     mSyncedGroups.add(group);
   } else {
     mUnsyncedGroups.add(group);
   }
 }
  protected void showAddSync(ContextMenu menu, final AccountDisplay account, final int syncMode) {
    menu.setHeaderTitle(R.string.dialog_sync_add);

    // Create item for each available, unsynced group
    for (final GroupDelta child : account.mUnsyncedGroups) {
      if (!child.getShouldSync()) {
        final CharSequence title = child.getTitle(this);
        menu.add(title)
            .setOnMenuItemClickListener(
                new OnMenuItemClickListener() {
                  public boolean onMenuItemClick(MenuItem item) {
                    // Adding specific group for syncing
                    if (child.mUngrouped && syncMode == SYNC_MODE_EVERYTHING) {
                      account.setShouldSync(true);
                    } else {
                      account.setShouldSync(child, true);
                    }
                    mAdapter.notifyDataSetChanged();
                    return true;
                  }
                });
      }
    }
  }