code: public void addAccount(Account parent, Account child)
              throws Exception {
          // Check to see if the account physically already exists - there is something funny with
          // some Firefox RDF exports where an RDF:li node gets duplicated multiple times.
          for (Account dup : parent.getChildren()) {
              if (dup == child) {
                  logger.warning("Duplicate RDF:li=" + child.getId() + " detected. Dropping duplicate");
                  return;
              }
          }
  
          int iterationCount = 0;
          final int maxIteration = 0x100000; // if we can't find a hash in 1 million iterations, something is wrong
          while (findAccountById(child.getId()) != null && (iterationCount++ < maxIteration)) {
              logger.warning("ID collision detected on '" + child.getId() + "', attempting to regenerate ID. iteration=" + iterationCount);
              child.setId(Account.createId(child));
          }
          if (iterationCount >= maxIteration) {
              throw new Exception("Could not genererate a unique ID in " + iterationCount + " iterations, this is really rare. I know it's lame, but change the description and try again.");
          }
  
          // add to new parent
          parent.getChildren().add(child);
          sendAccountAdded(parent, child);
  
          setDirty(true);
      }
docs: Adds an account to a parent.  This will first check to see if the account
  already has a parent and if so remove it from that parent before adding it
  to the new parent.
  
  @param parent The parent to add the child under.
  @param child  The child to add.
  @throws Exception On error.