tree data UPDATE updating NP cont dflt flag
diff --git a/src/tree_data.c b/src/tree_data.c
index e3d7ac9..4b24714 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -936,17 +936,7 @@
         }
 
         /* check for NP container whether its last non-default node is not being unlinked */
-        if (node->parent->schema && (node->parent->schema->nodetype == LYS_CONTAINER) &&
-                !(node->parent->flags & LYD_DEFAULT) && !(node->parent->schema->flags & LYS_PRESENCE)) {
-            LY_LIST_FOR(node->parent->child, iter) {
-                if ((iter != node) && !(iter->flags & LYD_DEFAULT)) {
-                    break;
-                }
-            }
-            if (!iter) {
-                node->parent->flags |= LYD_DEFAULT;
-            }
-        }
+        lyd_cont_set_dflt(lyd_parent(node));
 
         node->parent = NULL;
     }