function Link()
 {
     $link = "";
     $page = WebPortfolioPage::get()->first();
     if ($page) {
         $link = $page->Link("show/" . $this->ID . "/");
     } elseif ($this->ScreenshotID) {
         if ($screenshot = $this->Screenshot()) {
             $link = $screenshot->Link();
         }
     }
     return $link;
 }
 function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (isset($_REQUEST["MergeID"])) {
         $mergeID = intval($_REQUEST["MergeID"]);
         if ($mergeID) {
             $this->mergeInto = WebPortfolioWhatWeDidDescriptor::get()->byID($mergeID);
         }
     }
     if ($page = WebPortfolioPage::get()->first()) {
         $link = $page->Link() . 'show/' . $this->Code . "/";
         $this->Code = $page->generateURLSegment($this->Name);
     }
 }