public function addChildrenToEntity($name, array $childEntities, $setterParameters = [])
    {
        // For each relationship, keep a list of all children that were added.
        if (!isset($this->addedChildren[$name])) {
            $this->addedChildren[$name] = [];
        }

        foreach ($childEntities as $child) {
            $this->$name->add($child);
            $this->addedChildren[$name][] = $child;
        }
    }