public function Bookmark($DiscussionID) {
      // Make sure we are posting back.
      if (!$this->Request->IsPostBack())
         throw PermissionException('Javascript');
      
      $Session = Gdn::Session();
      
      if ($Session->UserID == 0)
         throw PermissionException('SignedIn');
      
      $Discussion = $this->DiscussionModel->GetID($DiscussionID);
      
      if (!$Discussion)
         throw NotFoundException('Discussion');
      
      $State = $this->DiscussionModel->BookmarkDiscussion($DiscussionID, $Session->UserID, $Discussion);

      // Update the user's bookmark count
      $CountBookmarks = $this->DiscussionModel->SetUserBookmarkCount($Session->UserID);
      $this->JsonTarget('.User-CountBookmarks', (string)$CountBookmarks);
      
      // Return the appropriate bookmark.
      require_once $this->FetchViewLocation('helper_functions', 'Discussions');
      $Html = BookmarkButton($Discussion);
//      $this->JsonTarget(".Section-DiscussionList #Discussion_$DiscussionID .Bookmark,.Section-Discussion .PageTitle .Bookmark", $Html, 'ReplaceWith');
      $this->JsonTarget("!element", $Html, 'ReplaceWith');

      // Add the bookmark to the bookmarks module.
      if($State) {
         // Grab the individual bookmark and send it to the client.
         $Bookmarks = new BookmarkedModule($this);
         if($CountBookmarks == 1) {
            // When there is only one bookmark we have to get the whole module.
            $Target = '#Panel';
            $Type = 'Append';
            $Bookmarks->GetData();
            $Data = $Bookmarks->ToString();
         } else {
            $Target = '#Bookmark_List';
            $Type = 'Prepend';
            $Loc = $Bookmarks->FetchViewLocation('discussion');
            
            ob_start();
            include($Loc);
            $Data = ob_get_clean();
         }
         
         $this->JsonTarget($Target, $Data, $Type);
      } else {
         // Send command to remove bookmark html.
         if($CountBookmarks == 0) {
            $this->JsonTarget('#Bookmarks', NULL, 'Remove');
         } else {
            $this->JsonTarget('#Bookmark_'.$DiscussionID, NULL, 'Remove');
         }
      }
      
      $this->Render('Blank', 'Utility', 'Dashboard');
   }