def METHOD_NAME(
    self, message: Mapping[str, Any], metadata: KafkaMessageMetadata
) -> Optional[ProcessedMessage]:
    try:
        received = datetime.utcfromtimestamp(message["received"])
        retention_days = enforce_retention(message["retention_days"], received)
        if "version" in message:
            processed = _normalize_sample_format(
                message, metadata, retention_days, received
            )
        else:
            processed = _normalize_legacy_format(
                message, metadata, retention_days, received
            )
    except EventTooOld:
        metrics.increment("event_too_old")
        return None
    except IndexError:
        metrics.increment("invalid_transaction")
        return None
    except ValueError:
        metrics.increment("invalid_uuid")
        return None
    except KeyError:
        metrics.increment("missing_field")
        return None
    return InsertBatch([processed], received)