public int visitParagraphEnd(Paragraph paragraph) {
      if (mFieldDepth > 0) {
        // The field code that is being converted continues onto another paragraph. We
        // need to copy the remaining content from this paragraph onto the next paragraph.
        Node nextParagraph = paragraph.getNextSibling();

        // Skip ahead to the next available paragraph.
        while (nextParagraph != null && nextParagraph.getNodeType() != NodeType.PARAGRAPH)
          nextParagraph = nextParagraph.getNextSibling();

        // Copy all of the nodes over. Keep a list of these nodes so we know not to remove them.
        while (paragraph.hasChildNodes()) {
          mNodesToSkip.add(paragraph.getLastChild());
          ((Paragraph) nextParagraph).prependChild(paragraph.getLastChild());
        }

        paragraph.remove();
      }

      return VisitorAction.CONTINUE;
    }
 /**
  * Checks whether the node is inside a field or should be skipped and then removes it if
  * necessary.
  */
 private void CheckDepthAndRemoveNode(Node node) {
   if (mFieldDepth > 0 && !mNodesToSkip.contains(node)) node.remove();
 }