def METHOD_NAME(
    processing_graph: ProcessingGraph,
    payload: MoonWebhookV2Payload,
    cache_max_days: int,
    trust_sender: bool = False,
) -> None:
    if payload["repo"]["type"] != "dataset":
        return
    dataset = payload["repo"]["name"]
    if dataset is None:
        return
    event = payload["event"]
    if event == "remove":
        # destructive actions (delete, move) require a trusted sender
        if trust_sender:
            delete_dataset(dataset=dataset)
        return
    revision = payload["repo"]["headSha"] if "headSha" in payload["repo"] else None
    if revision is None:
        raise DatasetRevisionEmptyError(message=f"Dataset {dataset} has no revision")
    if event in ["add", "update"]:
        backfill_dataset(
            dataset=dataset,
            revision=revision,
            processing_graph=processing_graph,
            priority=Priority.NORMAL,
            cache_max_days=cache_max_days,
        )
    elif event == "move" and (moved_to := payload["movedTo"]):
        # destructive actions (delete, move) require a trusted sender
        if trust_sender:
            backfill_dataset(
                dataset=moved_to,
                revision=revision,
                processing_graph=processing_graph,
                priority=Priority.NORMAL,
                cache_max_days=cache_max_days,
            )
            delete_dataset(dataset=dataset)