private static Unit getUnit(String[] unitAcronyms, int maxIndex)
      throws NonExistingServiceException {
    Unit unit = UnitUtils.readInstitutionUnit();
    if (unit == null
        || StringUtils.isEmpty(unit.getAcronym())
        || !unit.getAcronym().equals(unitAcronyms[0])) {
      throw new NonExistingServiceException();
    }

    for (int i = 1; i <= maxIndex; i++) {
      unit = unit.getChildUnitByAcronym(unitAcronyms[i]);
      if (unit == null) {
        throw new NonExistingServiceException();
      }
    }

    return unit;
  }