class EntityOwnershipStatistics extends AbstractEntityOwnerChangeListener {

    @Override
    public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
        for (DataTreeCandidate change : changes) {
            DataTreeCandidateNode changeRoot = change.getRootNode();
            LeafNode<?> ownerLeaf = (LeafNode<?>) changeRoot.getDataAfter().get();
            String entityType = entityTypeFromEntityPath(change.getRootPath());
            String newOwner = extractOwner(ownerLeaf);
            if (!Strings.isNullOrEmpty(newOwner)) {
                updateStatistics(entityType, newOwner, 1);
            }

            Optional<NormalizedNode<?, ?>> dataBefore = changeRoot.getDataBefore();
            if (dataBefore.isPresent()) {
                String origOwner = extractOwner((LeafNode<?>) changeRoot.getDataBefore().get());
                if (!Strings.isNullOrEmpty(origOwner)) {
                    updateStatistics(entityType, origOwner, -1);
                }
            }
        }
    }

      EntityOwnershipStatistics();

}