code: public function persist(ObjectManager $manager)
      {
          foreach ($this->entities as $entity) {
              $manager->persist($entity);
          }
  
          if ($this->root) {
              $manager->persist($this->root);
          }
      }
docs: Persist all stored entities with the given ObjectManager
  
  @param ObjectManager $manager