/**
   * Adds the given {@link ParameterBag} to this {@link GroupedParameterizedElement}
   *
   * @param bag the {@link ParameterBag} to add
   */
  public void addParameterBag(ParameterBag bag) {
    if (this.parameterBagMap == null) {
      this.parameterBagMap = new HashMap<>();
    }

    if (this.parameterBagMap.containsKey(bag.getId())) {
      String msg = "A ParameterBag already exists with id {0} on {1}";
      throw new StrolchException(MessageFormat.format(msg, bag.getId(), getLocator()));
    }
    this.parameterBagMap.put(bag.getId(), bag);
    bag.setParent(this);
  }