/**
  * Get all the valid StaffEdorg associations.
  *
  * @param staffId The staffId the SEOAs belong to.
  * @param filterByOwnership flag to check ownership
  * @return
  */
 public Set<Entity> locateValidSEOAs(String staffId, boolean filterByOwnership) {
   Set<Entity> validAssociations = new HashSet<Entity>();
   Iterable<Entity> associations = locateNonExpiredSEOAs(staffId);
   for (Entity association : associations) {
     if (!filterByOwnership || ownership.canAccess(association)) {
       validAssociations.add(association);
     }
   }
   return validAssociations;
 }
  /** Get current education organizations for the specified students. */
  private Set<String> getStudentsCurrentAssociatedEdOrgs(
      Set<String> studentIds, boolean filterByOwnership) {
    Set<String> edOrgIds = new HashSet<String>();

    NeutralQuery basicQuery =
        new NeutralQuery(
            new NeutralCriteria(
                ParameterConstants.STUDENT_ID, NeutralCriteria.CRITERIA_IN, studentIds));
    Iterable<Entity> associations =
        repo.findAll(EntityNames.STUDENT_SCHOOL_ASSOCIATION, basicQuery);

    if (associations != null) {
      for (Entity association : associations) {
        if (!filterByOwnership || ownership.canAccess(association)) {
          if (!isFieldExpired(
              association.getBody(), ParameterConstants.EXIT_WITHDRAW_DATE, false)) {
            edOrgIds.add((String) association.getBody().get(ParameterConstants.SCHOOL_ID));
          }
        }
      }
    }
    return edOrgIds;
  }