/**
  * Shipping Methods
  */
 private function defaultShippingMethod()
 {
     $method = new Market_ShippingMethodRecord();
     $method->name = 'Default Shipping Method';
     $method->enabled = true;
     $method->default = true;
     $method->save();
     $rule = new Market_ShippingRuleRecord();
     $rule->methodId = $method->id;
     $rule->description = "Catches all countries and states";
     $rule->name = "Catch All";
     $rule->enabled = true;
     $rule->save();
 }
 public function delete($model)
 {
     // Delete all rules first.
     MarketDbHelper::beginStackedTransaction();
     try {
         $rules = craft()->market_shippingRule->getAllByMethodId($model->id);
         foreach ($rules as $rule) {
             craft()->market_shippingRule->deleteById($rule->id);
         }
         Market_ShippingMethodRecord::model()->deleteByPk($model->id);
         MarketDbHelper::commitStackedTransaction();
         return true;
     } catch (\Exception $e) {
         MarketDbHelper::rollbackStackedTransaction();
         return false;
     }
     MarketDbHelper::rollbackStackedTransaction();
     return false;
 }