@Override
  public Collection<Animal> findAnimalsForEnvironment(Environment environment) {
    if (environment == null) {
      throw new IllegalArgumentException("Unable to find animals: null environment.");
    }
    List<AnimalEnvironment> animalEnvironments = aeDao.findByEnvironment(environment);
    List<Animal> environments = new ArrayList<>(animalEnvironments.size());

    for (AnimalEnvironment ae : animalEnvironments) {
      environments.add(ae.getAnimal());
    }

    return environments;
  }
  @Override
  public Collection<Environment> findEnvironmentsForAnimal(Animal animal) {
    if (animal == null) {
      throw new IllegalArgumentException("Unable to find environments: null animal.");
    }
    List<AnimalEnvironment> animalEnvironments = aeDao.findByAnimal(animal);
    List<Environment> environments = new ArrayList<>(animalEnvironments.size());

    for (AnimalEnvironment ae : animalEnvironments) {
      environments.add(ae.getEnvironment());
    }

    return environments;
  }