code: private boolean moveContents(ContextNode oldNode, ContextNode newNode) throws InvalidNameException, NameAlreadyBoundException, NameNotFoundException, NotContextException {
          boolean emptied = true;
          Iterator<Entry<String, Object>> entries = oldNode.children.entrySet().iterator();
          while (entries.hasNext()) {
              Entry<String, Object> entry = entries.next();
              WSName name = new WSName(entry.getKey());
              Object child = entry.getValue();
              if (child instanceof AutoBindNode) {
                  emptied = false;
              } else if (child instanceof ServiceRegistration) {
                  ServiceRegistration<?> reg = (ServiceRegistration<?>) child;
                  String className = (String) reg.getReference().getProperty(JNDIServiceBinder.OSGI_JNDI_SERVICE_CLASS);
                  reg.setProperties(createServiceProperties(newNode.fullName.plus(name), className));
                  newNode.bind(name, reg);
                  entries.remove();
              } else if (child instanceof ContextNode) {
                  ContextNode oldChildNode = (ContextNode) child;
                  ContextNode newChildNode = newNode.createSubcontext(name);
                  if (moveContents(oldChildNode, newChildNode))
                      // if it was emptied, remove the node
                      // TODO - potential race condition here - need to prevent any additions during clean
                      entries.remove();
                  else
                      // if it wasn't emptied we need to keep its parent too
                      emptied = false;
              } else {
                  // there shouldn't be any other types of object in there!
                  if (tc.isDebugEnabled())
                      Tr.debug(tc, "Unexpected object type found in internal tree", oldNode.fullName + WSName.SEPARATOR + entry.getKey(), child);
                  // remove it anyway, and don't copy it to the new location
                  entries.remove();
              }
          }
          return emptied;
      }
docs: Move all the contents of the node and the node itself, as far as possible.
  Do NOT move any external entries (i.e. anything inserted directly into the
  service registry), since we cannot actually remove these from the service
  registry itself, and that store is what takes precedence.