def METHOD_NAME(db):
    # CGAC agency
    baker.make(
        "accounts.TreasuryAppropriationAccount",
        pk=1,
        allocation_transfer_agency_id="123",
        agency_id="123",
        main_account_code="0111",
        fr_entity_code="2345",
    )
    # One more CGAC agency so we can test a different mapping
    baker.make(
        "accounts.TreasuryAppropriationAccount",
        pk=2,
        allocation_transfer_agency_id=None,
        agency_id="234",
        main_account_code="0222",
        fr_entity_code="3456",
    )
    # Shared FREC agency
    baker.make(
        "accounts.TreasuryAppropriationAccount",
        pk=3,
        allocation_transfer_agency_id=None,
        agency_id="345",
        main_account_code="0333",
        fr_entity_code="4567",
    )
    # A few agencies that are shared non-FREC agencies so we can test grouping/counting.
    baker.make(
        "accounts.TreasuryAppropriationAccount",
        pk=4,
        allocation_transfer_agency_id=None,
        agency_id="345",
        main_account_code="0444",
        fr_entity_code="5678",
    )
    baker.make(
        "accounts.TreasuryAppropriationAccount",
        pk=5,
        allocation_transfer_agency_id=None,
        agency_id="345",
        main_account_code="0444",
        fr_entity_code="6789",
    )
    baker.make(
        "accounts.TreasuryAppropriationAccount",
        pk=6,
        allocation_transfer_agency_id=None,
        agency_id="345",
        main_account_code="0444",
        fr_entity_code="6789",
    )
    # Stuff required to support the above.
    baker.make("accounts.FederalAccount", pk=1, agency_identifier="123", main_account_code="0111")
    baker.make("accounts.FederalAccount", pk=2, agency_identifier="234", main_account_code="0222")
    baker.make("accounts.FederalAccount", pk=3, agency_identifier="345", main_account_code="0333")
    baker.make("accounts.FederalAccount", pk=4, agency_identifier="345", main_account_code="0444")
    baker.make("references.FREC", frec_code="2345", associated_cgac_code="123")
    baker.make("references.FREC", frec_code="3456", associated_cgac_code="234")
    baker.make("references.FREC", frec_code="4567", associated_cgac_code="234")
    baker.make("references.FREC", frec_code="5678", associated_cgac_code="123")
    baker.make("references.FREC", frec_code="6789", associated_cgac_code="234")
    baker.make("references.ToptierAgency", pk=1, toptier_code="123")  # CGAC agency
    baker.make("references.ToptierAgency", pk=2, toptier_code="234")  # Another CGAC agency
    baker.make("references.ToptierAgency", pk=3, toptier_code="4567")  # FREC agency