   check position, Number if position?
   #check oldParent, Boolean
   #check importing, Boolean
+
+  cmsg = Messages.findOne child
+  unless cmsg?
+    throw new Meteor.Error 'messageParent.noChild',
+      "Missing child message #{child} to reparent"
+
   if parent?
     pmsg = Messages.findOne parent
-    unless pmsg
-      console.warn 'Missing parent', parent, 'for child', child
-      return  ## This should only happen in client simulation
+    unless pmsg?
+      ## This can happen in client simulation when parent isn't in
+      ## subscription.
+      return if @isSimulation
+      throw new Meteor.Error 'messageParent.noParent',
+        "Missing parent message #{parent} to reparent"
     group = pmsg.group
     root = pmsg.root ? parent
-
-    ## Check before creating a cycle in the parent pointers!
+  else
+    group = cmsg.group  ## xxx can't reparent into root message of other group
+    root = null
+
+  unless canEdit(child) and canPost group, parent
+    throw new Meteor.Error 'messageParent.unauthorized',
+      "Insufficient privileges to reparent message #{child} into #{parent}"
+
+  ## Check before creating a cycle in the parent pointers.
+  ## This can happen only if we are making the message nonroot (parent
+  ## nonnull) and the child has children of its own.
+  if parent? and cmsg.children?.length
     ancestor = pmsg
     while ancestor?
       if ancestor._id == child
         throw new Meteor.Error 'messageParent.cycle',
           "Attempt to make #{child} its own ancestor (via #{parent})"
       ancestor = findMessageParent ancestor
-  else
-    group = child.group  ## xxx can't specify other group...
-    root = null
-
-  unless canEdit(child) and canPost group, parent
-    throw new Meteor.Error 'messageParent.unauthorized',
-      "Insufficient privileges to reparent message #{child} into #{parent}"
-
-  cmsg = Messages.findOne child
+
   oldPosition = null
   oldSiblingsBefore = null
   oldSiblingsAfter = null

  Messages._ensureIndex [
    ['group', 1]
    ['updated', -1]
  ]

@rootMessages = (group) ->

          $set: root: root ? child
        ,
          multi: true
    else if cmsg.children?.length
      ## To reparent root message (with children),
      ## change the root of all descendants.
      Messages.update
        root: child
      ,
