private static NetworkRingInfo mergeNetworkRingInfo(List<NetworkRingInfo> networkList)
      throws ParseException {
    LOG.debug("merge start..");
    if (networkList.size() > 1) {

      NetworkRingInfo tmp;
      NetworkRingInfo result = networkList.get(0);
      DateFormat dateFormat = new SimpleDateFormat(NishaDateTime.dateTimePattern);
      for (int i = 1; i < networkList.size(); i++) {
        tmp = networkList.get(i);
        if (dateFormat
            .parse(tmp.getLastChangeDate())
            .after(dateFormat.parse(result.getLastChangeDate()))) {
          result.setLastChangeDate(tmp.getLastChangeDate());
          result.setLastChangeType(tmp.getLastChangeType());
          result.setLastChangeNode(tmp.getLastChangeNode());

          for (String nodeName : tmp.getNetworkNodeNames()) {
            if (!result.getNetworkNodeNames().contains(nodeName)) {
              result.getNetworkNodeNames().add(nodeName);
            }
          }
        }
        LOG.debug("removing {}", tmp.get_id());
        CouchDbConnector.getCouchDbConnector().urisDbClient.remove(tmp.get_id(), tmp.get_rev());
      }
      CouchDbConnector.getCouchDbConnector().urisDbClient.update(result);
      LOG.debug("network ring info merged - success");
      return result;
    }
    return null;
  }
  public static boolean updateNetwork(NodeRingInfo nodeRingInfo, NetworkChangeType changeType) {
    String msg;
    try {

      boolean createNetworkDocIfNeeded = true;
      NetworkRingInfo networkRingInfo = getNetworkRingInfo(createNetworkDocIfNeeded);
      if (networkRingInfo == null) {
        msg = "no document of network ring info";
        throw new IllegalArgumentException(msg);
      }
      networkRingInfo =
          updateNetworkLastChange(
              networkRingInfo, changeType, nodeRingInfo.getNodeDomainNameFromRingInfo());

      if (changeType.equals(NetworkChangeType.NODE_ADD)) {
        List<String> names = networkRingInfo.getNetworkNodeNames();
        if (!names.contains(nodeRingInfo.getNodeDomainNameFromRingInfo())) {
          names.add(nodeRingInfo.getNodeDomainNameFromRingInfo());
        }
      }
      CouchDbConnector.getCouchDbConnector().urisDbClient.update(networkRingInfo);
      return true;

    } catch (Exception e) {
      return false;
    }
  }