@Override
  protected void doImportStagedModel(PortletDataContext portletDataContext, WikiNode node)
      throws Exception {

    long userId = portletDataContext.getUserId(node.getUserUuid());

    ServiceContext serviceContext = portletDataContext.createServiceContext(node);

    WikiNode importedNode = null;

    if (portletDataContext.isDataStrategyMirror()) {
      WikiNode existingNode =
          WikiNodeLocalServiceUtil.fetchNodeByUuidAndGroupId(
              node.getUuid(), portletDataContext.getScopeGroupId());

      String initialNodeName = PropsValues.WIKI_INITIAL_NODE_NAME;

      if ((existingNode == null) && initialNodeName.equals(node.getName())) {

        WikiNode initialNode =
            WikiNodeLocalServiceUtil.fetchNode(
                portletDataContext.getScopeGroupId(), node.getName());

        if (initialNode != null) {
          WikiNodeLocalServiceUtil.deleteWikiNode(initialNode);
        }
      }

      if (existingNode == null) {
        serviceContext.setUuid(node.getUuid());

        importedNode =
            WikiNodeLocalServiceUtil.addNode(
                userId, node.getName(), node.getDescription(), serviceContext);
      } else {
        importedNode =
            WikiNodeLocalServiceUtil.updateNode(
                existingNode.getNodeId(), node.getName(), node.getDescription(), serviceContext);
      }
    } else {
      String initialNodeName = PropsValues.WIKI_INITIAL_NODE_NAME;

      if (initialNodeName.equals(node.getName())) {
        WikiNode initialNode =
            WikiNodeLocalServiceUtil.fetchNode(
                portletDataContext.getScopeGroupId(), node.getName());

        if (initialNode != null) {
          WikiNodeLocalServiceUtil.deleteWikiNode(initialNode);
        }
      }

      String nodeName = getNodeName(portletDataContext, node, node.getName(), 2);

      importedNode =
          WikiNodeLocalServiceUtil.addNode(userId, nodeName, node.getDescription(), serviceContext);
    }

    portletDataContext.importClassedModel(node, importedNode);
  }
  @Override
  protected void doRestoreStagedModel(PortletDataContext portletDataContext, WikiNode node)
      throws Exception {

    long userId = portletDataContext.getUserId(node.getUserUuid());

    WikiNode existingNode =
        WikiNodeLocalServiceUtil.fetchNodeByUuidAndGroupId(
            node.getUuid(), portletDataContext.getScopeGroupId());

    if ((existingNode == null) || !existingNode.isInTrash()) {
      return;
    }

    TrashHandler trashHandler = existingNode.getTrashHandler();

    if (trashHandler.isRestorable(existingNode.getNodeId())) {
      trashHandler.restoreTrashEntry(userId, existingNode.getNodeId());
    }
  }