async def METHOD_NAME(
    self,
    user: User,
    dataset: ServiceDataset,
    query: Optional[ServiceBaseRecordsQuery] = None,
    mark_as_discarded: bool = False,
) -> DeleteRecordsOut:
    processed, discarded, deleted = None, None, None
    if mark_as_discarded:
        processed, discarded = await self.__dao__.update_records_by_query(
            dataset,
            query=query,
            status=TaskStatus.discarded,
        )
    else:
        if not await is_authorized(user, DatasetPolicy.METHOD_NAME(dataset)):
            raise ForbiddenOperationError(
                "You don't have the necessary permissions to delete records on this dataset. "
                "Only administrators can delete datasets"
            )
        processed, deleted = await self.__dao__.delete_records_by_query(dataset, query=query)
    return DeleteRecordsOut(
        processed=processed or 0,
        discarded=discarded or 0,
        deleted=deleted or 0,
    )