code: function (node, refNode, before) {
          var parent;
  
          if (node.parent) {
            node.remove();
          }
  
          parent = refNode.parent || this;
  
          if (before) {
            if (refNode === parent.firstChild) {
              parent.firstChild = node;
            } else {
              refNode.prev.next = node;
            }
  
            node.prev = refNode.prev;
            node.next = refNode;
            refNode.prev = node;
          } else {
            if (refNode === parent.lastChild) {
              parent.lastChild = node;
            } else {
              refNode.next.prev = node;
            }
  
            node.next = refNode.next;
            node.prev = refNode;
            refNode.next = node;
          }
  
          node.parent = parent;
  
          return node;
        }
docs: Inserts a node at a specific position as a child of the current node.
  
  @example
  parentNode.insert(newChildNode, oldChildNode);
  
  @method insert
  @param {tinymce.html.Node} node Node to insert as a child of the current node.
  @param {tinymce.html.Node} refNode Reference node to set node before/after.
  @param {Boolean} before Optional state to insert the node before the reference node.
  @return {tinymce.html.Node} The node that got inserted.