code: public void cloneComments() {
      QueryQuestionCommentDAO queryQuestionCommentDAO = new QueryQuestionCommentDAO();
      
      while (!queue.isEmpty()) {
        QueryQuestionComment queryComment = queue.remove(0);
        QueryQuestionComment originalParentComment = queryComment.getParentComment();
        
        QueryReply newReply = replyMap.get(queryComment.getQueryReply().getId());
        if (originalParentComment != null && !commentMap.containsKey(originalParentComment.getId())) {
          if (this.cloneIds.contains(originalParentComment.getId())) {
            iterations++;
            if (iterations > FAILSAFE_COUNT) {
              throw new SmvcRuntimeException(EdelfoiStatusCode.NO_PARENT_COMMENT, "Comment cloning failed because parent comment could not be found");
            }
  
            queue.add(queryComment);
          } else {
            this.cloneIds.remove(queryComment.getId());
            logger.severe(() -> String.format("Could not clone comment %d because parent did not exist on original list", queryComment.getId()));
          }
          
          continue;
        }
        
        QueryQuestionComment parentComment = originalParentComment == null ? null : commentMap.get(originalParentComment.getId());
        QueryQuestionComment newComment = queryQuestionCommentDAO.create(
            newReply,
            queryPage,
            parentComment,
            queryComment.getComment(),
            queryComment.getHidden(),
            queryComment.getCreator(),
            queryComment.getCreated(),
            queryComment.getLastModifier(),
            queryComment.getLastModified());
        
        commentMap.put(queryComment.getId(), newComment);
      }
    }
docs: Clones comments