src/MediaTrait.php
private function removeExistingMedia() {
    $existing_media = $this->getMedia($this->group);

    if (!$existing_media->isEmpty()) {
      return $this->deleteMedia($this->group);
    }

    return 0;
  }
private function removeExistingMedia() {
    $existing_media = $this->getMedia($this->group);

    if (!$existing_media->isEmpty()) {
      return $this->deleteMedia($this->group);
    }

    return 0;
  }
Remove any media that already exists for the current group type

@return int
The number of elements removed