def METHOD_NAME(self, db: Session, root, payment_list):
    logging.info(
        f"Indexing {len(payment_list)} proofs for payment cycle {root['paymentCycle']}"
    )
    existing_root = (
        db.query(models.Root)
        .filter_by(
            rewardProgramId=root["rewardProgram"]["id"],
            paymentCycle=root["paymentCycle"],
        )
        .first()
    )
    if not existing_root:
        new_root = models.Root(
            rootHash=root["rootHash"],
            rewardProgramId=root["rewardProgram"]["id"],
            paymentCycle=int(root["paymentCycle"]),
            blockNumber=int(root["blockNumber"]),
            timestamp=datetime.fromtimestamp(int(root["timestamp"])),
        )
        db.add(new_root)
    leafs = []
    proofs = []
    for payment in payment_list:
        token, amount = self.decode_payment(payment)
        explanation_data_v = payment.get("explanationData", {})
        explanation_data = (
            json.loads(explanation_data_v)
            if isinstance(explanation_data_v, str)
            else dict(explanation_data_v)
        )
        # explanation_data_v of str represents the new column format
        # new column format: string (that can be parsed to json)
        # old column format, map<string, string> (a dictionary)
        i = models.Proof(
            rootHash=payment["root"],
            paymentCycle=payment["paymentCycle"],
            tokenAddress=to_checksum_address(token) if token else "",
            payee=payment["payee"],
            proofArray=payment["proof"],
            rewardProgramId=payment["rewardProgramID"],
            amount=str(amount),
            leaf=payment["leaf"],
            validFrom=payment["validFrom"],
            validTo=payment["validTo"],
            explanationId=payment.get("explanationId"),
            explanationData=explanation_data,
        )
        proofs.append(i)
        leafs.append(payment["leaf"])
    for existing_proof in (
        db.query(models.Proof).filter(models.Proof.leaf.in_(leafs)).all()
    ):
        try:
            i = list(p.leaf == existing_proof.leaf for p in proofs).index(
                True
            )  # find index of new proofs that already has leaf in db
            del proofs[i]  # remove that proof from the array
        except ValueError:
            pass
    db.add_all(proofs)