data tree BUGFIX keep first sibling pointer correct

In case it is supposed to point to the first data sibling
of a module, do not break this.
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index a379400..79d789c 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -397,6 +397,25 @@
 }
 
 void
+lyd_del_move_root(struct lyd_node **root, const struct lyd_node *to_del, const struct lys_module *mod)
+{
+    if (*root && (lyd_owner_module(*root) != mod)) {
+        /* there are no data of mod so this is simply the first top-level sibling */
+        mod = NULL;
+    }
+
+    if ((*root != to_del) || (*root)->parent) {
+        return;
+    }
+
+    *root = (*root)->next;
+    if (mod && *root && (lyd_owner_module(to_del) != lyd_owner_module(*root))) {
+        /* there are no more nodes from mod */
+        *root = lyd_first_sibling(*root);
+    }
+}
+
+void
 ly_free_prefix_data(LY_PREFIX_FORMAT format, void *prefix_data)
 {
     struct ly_set *ns_list;