code: public function erase(EntityInterface $entity)
      {
          $dependencies = $this->triggerEvent(DependencyResultEvent::DELETE, $entity);
  
          foreach ($dependencies as $result) {
              if ($result->isDelete()) {
                  foreach ($result->getEntities() as $dependendEntity) {
                      $this->repositories->remove($dependendEntity);
                  }
              }
          }
  
          $this->repositories->remove($entity);
  
          return $dependencies;
      }
docs: Deletes an entity.
  
  Triggers the DependencyResultEvent::DELETE event on the
  "Core/EntityEraser/Dependencies/Events" event manager.
  
  Removes the entity from the database.
  
  @param EntityInterface $entity
  
  @return \Core\Service\EntityEraser\DependencyResultCollection
  @uses triggerEvent