private function getChildIds(ModelInterface $model)
    {
        if (null === ($childCollections = $model->getMeta($model::CHILD_COLLECTIONS))) {
            return [];
        }

        $ids = [ModelId::fromModel($model)->getSerialized()];

        $childIds = [];
        foreach ($childCollections as $collection) {
            foreach ($collection as $child) {
                $childIds[] = $this->getChildIds($child);
            }
        }

        return \array_merge($ids, ...$childIds);
    }