def METHOD_NAME(self):
    """Delete a record."""
    from b2share.modules.deposit.api import Deposit
    pid = self.pid
    # Fetch deposit id from record and resolve deposit record and pid.
    depid = PersistentIdentifier.get(DepositUUIDProvider.pid_type,
                                     pid.pid_value)
    if depid.status == PIDStatus.REGISTERED:
        depid, deposit = Resolver(
            pid_type=depid.pid_type,
            object_type='rec',
            # Retrieve the deposit with the Record class on purpose
            # as the current Deposit api prevents the deletion of
            # published deposits.
            getter=Deposit.get_record,
        ).resolve(depid.pid_value)
        deposit.METHOD_NAME()
    # Mark all record's PIDs as DELETED
    all_pids = PersistentIdentifier.query.filter(
        PersistentIdentifier.object_type == pid.object_type,
        PersistentIdentifier.object_uuid == pid.object_uuid,
    ).all()
    for rec_pid in all_pids:
        if not rec_pid.is_deleted():
            rec_pid.METHOD_NAME()
    # Mark the bucket as deleted
    # delete all buckets linked to the deposit
    res = Bucket.query.join(RecordsBuckets).\
        filter(RecordsBuckets.bucket_id == Bucket.id,
               RecordsBuckets.record_id == self.id).all()
    for bucket in res:
        bucket.deleted = True
    # Mark the record and deposit as deleted. The record is unindexed
    # via the trigger on record deletion.
    super(B2ShareRecord, self).METHOD_NAME()
    version_master = PIDVersioning(child=pid)
    # If the parent has no other children and no draft child
    # mark it as deleted
    if not version_master.children.all():
        if not version_master.draft_child:
            version_master.parent.METHOD_NAME()
    else:
        # Reindex the "new" last published version in order to have
        # its "is_last_version" up to date.
        RecordIndexer().index_by_id(version_master.last_child.object_uuid)