public void delete(boolean removeFromParent) {
    AjaxServlet.invalidateFrontPageCache(getGroup().getId());
    if (parent == null) {
      // we're a toplevel post

      if (getWhiteboard() == null) {
        Iterator<PostModel> it = replies.iterator();
        while (it.hasNext()) {
          PostModel reply = it.next();
          reply.delete(false);
          it.remove();
          reply.setParent(null);
        }
      } else {
        getWhiteboard().delete();
      }
    } else {
      // we're a reply
      subject = "reply";
      intro = "parent's subject was: " + parent.getSubject();

      Calendar lReply = GregorianCalendar.getInstance();
      Calendar rCal = GregorianCalendar.getInstance();
      lReply.setTime(parent.getDate());

      for (PostModel r : parent.getReplies()) {
        rCal.setTime(r.getDate());
        if (!r.getGroup().equals(Helpers.getGroup("DeletedPosts"))
            && lReply.before(rCal)
            && !r.equals(this)) {
          lReply.setTime(r.getDate());
        }
      }

      parent.setLastReply(lReply.getTime());
      if (removeFromParent) {
        parent.getReplies().remove(this);
        parent = null;
      }
    }

    subject = "*deleted* " + subject;
    intro =
        "deleted "
            + (new Date()).toString()
            + ", original group was: "
            + group.getName()
            + "\n- - -\n"
            + intro;
    this.group = Helpers.getGroup("DeletedPosts");
    getSearchable().delete();
  }
  public PostModel clone() {
    PostModel p2 = new PostModel();
    p2.setPoster(getPoster());
    p2.setGroup(group);
    p2.setSubject(subject);
    p2.setIntro(intro);
    p2.setBody(body);
    p2.setDate(date);
    p2.setTags(tags);
    p2.setParent(parent);
    p2.setReplies(replies);
    p2.newReplies = newReplies;
    p2.setEmailed(emailed);

    return p2;
  }