function trySave()
 {
     $tag = common_canonical_tag($this->trimmed('tag'));
     $description = $this->trimmed('description');
     $private = $this->boolean('private');
     $delete = $this->arg('delete');
     $confirm = $this->arg('confirm');
     $cancel = $this->arg('cancel');
     if ($delete && $cancel) {
         // TRANS: Form validation error displayed if the form data for deleting a tag was incorrect.
         $this->showForm(_('Delete aborted.'));
         return;
     }
     $set_private = $private && $this->peopletag->private != $private;
     if ($delete && !$confirm) {
         // TRANS: Text in confirmation dialog for deleting a tag.
         $this->showConfirm(_('Deleting this tag will permanantly remove ' . 'all its subscription and membership records. ' . 'Do you still want to continue?'), array('delete' => 1));
         return;
     } else {
         if (common_valid_tag($tag)) {
             // TRANS: Form validation error displayed if a given tag is invalid.
             $this->showForm(_('Invalid tag.'));
             return;
         } else {
             if ($tag != $this->peopletag->tag && $this->tagExists($tag)) {
                 // TRANS: Form validation error displayed if a given tag is already present.
                 // TRANS: %s is the already present tag.
                 $this->showForm(sprintf(_('You already have a tag named %s.'), $tag));
                 return;
             } else {
                 if (Profile_list::descriptionTooLong($description)) {
                     $this->showForm(sprintf(_m('Description is too long (maximum %d character).', 'Description is too long (maximum %d characters).', Profile_list::maxDescription()), Profile_list::maxDescription()));
                     return;
                 } else {
                     if ($set_private && !$confirm && !$cancel) {
                         $fwd = array('tag' => $tag, 'description' => $description, 'private' => (int) $private);
                         // TRANS: Text in confirmation dialog for setting a tag from public to private.
                         $this->showConfirm(_('Setting a public tag as private will ' . 'permanently remove all the existing ' . 'subscriptions to it. Do you still want to continue?'), $fwd);
                         return;
                     }
                 }
             }
         }
     }
     $this->peopletag->query('BEGIN');
     $orig = clone $this->peopletag;
     $this->peopletag->tag = $tag;
     $this->peopletag->description = $description;
     if (!$set_private || $confirm) {
         $this->peopletag->private = $private;
     }
     $result = $this->peopletag->update($orig);
     if (!$result) {
         common_log_db_error($this->group, 'UPDATE', __FILE__);
         // TRANS: Server error displayed when updating a list fails.
         $this->serverError(_('Could not update list.'));
     }
     $this->peopletag->query('COMMIT');
     if ($set_private && $confirm) {
         Profile_tag_subscription::cleanup($this->peopletag);
     }
     if ($delete) {
         // This might take quite a bit of time.
         $this->peopletag->delete();
         // send home.
         common_redirect(common_local_url('all', array('nickname' => $this->tagger->nickname)), 303);
     }
     if ($tag != $orig->tag) {
         common_redirect(common_local_url('editpeopletag', array('tagger' => $this->tagger->nickname, 'tag' => $tag)), 303);
     } else {
         // TRANS: Edit list form success message.
         $this->showForm(_('Options saved.'));
     }
 }
 /**
  * Gracefully delete one or many people tags
  * along with their members and subscriptions data
  *
  * @return boolean success
  */
 function delete($useWhere = false)
 {
     // force delete one item at a time.
     if (empty($this->id)) {
         $this->find();
         while ($this->fetch()) {
             $this->delete();
         }
     }
     Profile_tag::cleanup($this);
     Profile_tag_subscription::cleanup($this);
     self::blow('profile:lists:%d', $this->tagger);
     return parent::delete($useWhere);
 }