// ----------------------------------------------------------
  private NSArray<Submission> extractSubmissions(NSArray<UserSubmissionPair> userSubs) {
    NSMutableArray<Submission> submissions = new NSMutableArray<Submission>();

    for (UserSubmissionPair pair : userSubs) {
      if (pair.userHasSubmission()) {
        submissions.addObject(pair.submission());
      }
    }

    return submissions;
  }
  // ----------------------------------------------------------
  protected void beforeAppendToResponse(WOResponse response, WOContext context) {
    log.debug("appendToResponse()");

    subStats = new HashMap<AssignmentOffering, Submission.CumulativeStats>();
    offerings.setObjectArray(assignmentOfferings(courseOfferings()));
    if (log.isDebugEnabled()) {
      log.debug("assignment offerings:");
      for (AssignmentOffering ao : offerings.allObjects()) {
        log.debug("\t" + ao);
      }
    }

    NSMutableArray<Submission> staffSubs = new NSMutableArray<Submission>();
    NSArray<User> admins = User.administrators(localContext());

    for (AssignmentOffering ao : offerings.displayedObjects()) {
      // Stuff the index variable into the public key so the group/stats
      // methods will work for us
      assignmentOffering = ao;
      NSArray<UserSubmissionPair> subs =
          Submission.submissionsForGrading(
              localContext(),
              ao,
              true, // omitPartners
              omitStaff,
              studentStats());
      userGroup().setObjectArray(subs);

      @SuppressWarnings("unchecked")
      NSArray<User> staff =
          ERXArrayUtilities.arrayByAddingObjectsFromArrayWithoutDuplicates(
              ao.courseOffering().staff(), admins);
      staffSubs.addAll(
          extractSubmissions(
              Submission.submissionsForGrading(
                  localContext(),
                  ao,
                  true, // omitPartners
                  staff,
                  null)));
    }

    staffSubmissionGroup.setObjectArray(staffSubs);

    selectedUserSubmissionForPickerDialog = null;
    allUserSubmissionsForNavigationForPickerDialog = null;

    super.beforeAppendToResponse(response, context);
  }