```\n// transfer the assets into the pool\n// whatever we couldn't pay back\nuint256 lostAmt = principalOwed > recoveredFunds ? principalOwed - recoveredFunds : 0;\n\nuint256 totalOwed = interestPaid + principalOwed;\n\nasset.transferFrom(\n msg.sender,\n address(this),\n totalOwed > recoveredFunds ? recoveredFunds : totalOwed\n);\n// write off only what we lost\ntotalBorrowed -= lostAmt;\n// set the account with the funds the pool lost\naccount.principal = lostAmt;\n\naccount.save(router, agentID, id);\n```\n