Resizable Groups with parenthood determined by location of nodes inside it

We need functionality similar to the Resizable Groups that is available http://gojs.net/latest/intro/sizedGroups.html
The group can be resized manually, and w/o connection to the children layout inside it.
The children inside the group can be moved around and even move outside the group.

The only feature we are missing is that when child nodes are dragged outside the group, the remain connected to the group, and move when the group is moved (they seem to remain children of the group even when put outside the group).

We would like the group parenthood relation to be determined by the position of the child node. If any non-child node is dragged into the group, it needs to become a child of that group. If, on the other hand a child is dragged of the group, it needs to no longer be grouped by it.

Any advice?

Do something like the Planogram sample, http://gojs.net/latest/samples/planogram.html or the Regrouping sample, http://gojs.net/latest/samples/regrouping.html.

Fundamentally, implement event handlers for mouseDrop on both the Group, http://gojs.net/latest/api/symbols/GraphObject.html#mouseDrop as well as the Diagram, http://gojs.net/latest/api/symbols/Diagram.html#mouseDrop.

Note also the convenience property that you’ll probably want to set to true: http://gojs.net/latest/api/symbols/Group.html#handlesDragDropForMembers.