How to implement manage attaching and detaching nested relationships in OctoberCMS?

I looked at an example here for creating data using nested relationships, but I didn’t understand how to manage the attachment and detachment of nested relationship data.

How to create and make partials correctly in this case?

OctoberCMS version: 2.x (not 3.x)

I think this may need more detail. The nested relationship data can be managed with another Form widget.

…although, upgrading to v3 will solve it since it supports nested relations out of the box.