Saving Multiple Objects in a Transaction

<?php

// $foo = Mage::getModel('.....
// $bar = Mage::getModel('.....

$transaction = Mage::getModel('core/resource_transaction');
$transaction->addObject($foo);
$transaction->addObject($bar);
$transaction->save(); // runs save on all objects. On error -> rollback

Magento itself uses the core/resource_transaction model when saving an order during checkout. But it can also be useful in your own module.