private Thesaurus checkThesaurusId(String thesaurusId) {
   Thesaurus thesaurus = thesaurusDAO.getById(thesaurusId);
   if (thesaurus == null) {
     throw new BusinessException("Invalid thesaurusId : " + thesaurusId, "invalid-thesaurus-id");
   } else {
     logger.debug("thesaurus with id =  " + thesaurusId + " found");
   }
   return thesaurus;
 }
  @Override
  public List<ThesaurusConcept> getAvailableConceptsOfArray(
      String arrayId, String thesaurusId, String like) {
    ThesaurusArray currentArray = new ThesaurusArray();
    List<ThesaurusConcept> returnAvailableConcepts = new ArrayList<ThesaurusConcept>();

    if (StringUtils.isNotEmpty(arrayId)) {
      currentArray = thesaurusArrayDAO.getById(arrayId);
    }

    if (StringUtils.isNotEmpty(arrayId) && currentArray.getSuperOrdinateConcept() != null) {
      // We get all arrays matching our superordinate, excluding our
      // concept from the list
      List<ThesaurusArray> arrayWithSameSuperOrdinate =
          thesaurusArrayDAO.getConceptSuperOrdinateArrays(
              currentArray.getSuperOrdinateConcept().getIdentifier(), currentArray.getIdentifier());
      returnAvailableConcepts =
          thesaurusConceptDAO.getChildrenConcepts(
              currentArray.getSuperOrdinateConcept().getIdentifier(), 0, like);

      for (ThesaurusArray thesaurusArray : arrayWithSameSuperOrdinate) {
        Set<ThesaurusArrayConcept> conceptOfEachArray = thesaurusArray.getConcepts();
        for (ThesaurusArrayConcept thesaurusConcept : conceptOfEachArray) {
          returnAvailableConcepts.remove(thesaurusConcept.getConcepts());
        }
      }
    } else {
      // The array is null or has no superordinate : we get all topterm
      // concepts which are not already in other arrays
      List<ThesaurusArray> arrayWithNoSuperOrdinate =
          thesaurusArrayDAO.getConceptSuperOrdinateArrays(null);
      returnAvailableConcepts =
          thesaurusConceptDAO.getTopTermThesaurusConcept(
              thesaurusDAO.getById(thesaurusId), 0, like);
      for (ThesaurusArray thesaurusArray : arrayWithNoSuperOrdinate) {
        Set<ThesaurusArrayConcept> conceptOfEachArrayWithoutSuperordinate =
            thesaurusArray.getConcepts();
        for (ThesaurusArrayConcept thesaurusConcept : conceptOfEachArrayWithoutSuperordinate) {
          returnAvailableConcepts.remove(thesaurusConcept.getConcepts());
        }
      }
    }
    return returnAvailableConcepts;
  }