code: protected function deleteFieldsForCFGroup($customFieldsGroup)
      {
          $em = $this->getContainer()
              ->get('doctrine.orm.default_entity_manager');
  
          foreach ($customFieldsGroup->getCustomFields() as $field) {
              $em->remove($field);
          }
      }
docs: Delete the existing custom fields for a given customFieldGroup
  
  @param CustomFieldsGroup $customFieldsGroup : The custom field group