private void documentChanged(CouchChange changes) throws DaoException {
    List<StatisticResult> affectedStatistics = _statisticDao.getAffected(changes.getId());
    Document document = changes.getDoc();

    for (StatisticResult statistic : affectedStatistics) {
      switch (document.getDocTypeEnum()) {
        case PRODUCT:
          {
            Product targetProduct = statistic.getProduct();
            // update title
            targetProduct.setTitle(document.getTitle());

            // update category
            targetProduct.setCategory(
                _updateCategory(document, targetProduct.getCategoryId(), _productCategoryDao));
          }
          break;
        case PACKAGE:
          // update quantity
          if (document.getPropertyList().containsKey("quantity")) {
            Object quantityObject = document.getProperty("quantity");
            if (quantityObject instanceof Map<?, ?>) {
              Map<?, ?> quantityMap = (Map<?, ?>) quantityObject;
              Unit unit = _unitDao.get(quantityMap.get("unitId").toString());
              Quantity quantity =
                  new Quantity(
                      new BigDecimal(quantityMap.get("quantity").toString()),
                      new Unit(null, unit.getId(), null, unit.getTitle(), null, 0));
              statistic.getPackage().setQuantity(quantity);
            }
          }
          break;
        case SHOP:
          {
            Shop targetShop = statistic.getShop();

            // update title
            targetShop.setTitle(document.getTitle());

            // update category
            targetShop.setCategory(
                _updateCategory(document, targetShop.getCategoryId(), _shopCategoryDao));

            // update address (lat+lon)
            if (document.getAddress() != null) {
              statistic.getAddress().setPos(document.getAddress().getPos());
            } else if (statistic.getAddress() != null) statistic.setAddress(null);
          }
          break;
        case PRODUCTCATEGORY:
          // update title
          statistic.getProduct().getCategory().setTitle(document.getTitle());
          break;
        case SHOPCATEGORY:
          // update title
          statistic.getShop().getCategory().setTitle(document.getTitle());
          break;
        case UNIT:
          // update title
          statistic.getPackage().getQuantity().getUnit().setTitle(document.getTitle());
          // TODO: update parent
          break;
      }
      statistic.setSequenceNr(changes.getSeq());
      _statisticDao.update(statistic);
    }
  }