public function onAfterWrite()
 {
     parent::onAfterWrite();
     foreach ($this->Children() as $child) {
         if ($child instanceof SummitPage) {
             $child->SummitID = $this->SummitID;
             $child->write();
         }
     }
 }
 function onAfterWrite()
 {
     parent::onAfterWrite();
     $summit = Summit::get_active();
     //update all relationships with sponsors
     foreach ($this->Companies() as $company) {
         if (isset($_REQUEST["SponsorshipType_{$company->ID}"])) {
             $type = $_REQUEST["SponsorshipType_{$company->ID}"];
             $sql = "UPDATE SummitSponsorPage_Companies SET SponsorshipType ='{$type}', SummitID = '{$summit->ID}' WHERE CompanyID={$company->ID} AND SummitSponsorPageID={$this->ID};";
             DB::query($sql);
         }
         if (isset($_REQUEST["SubmitPageUrl_{$company->ID}"])) {
             $page_url = $_REQUEST["SubmitPageUrl_{$company->ID}"];
             $sql = "UPDATE SummitSponsorPage_Companies SET SubmitPageUrl ='{$page_url}', SummitID = '{$summit->ID}' WHERE CompanyID={$company->ID} AND SummitSponsorPageID={$this->ID};";
             DB::query($sql);
         }
     }
 }