Every thing is working fine let say if I check and uncheck any parent so it will save/remove corresponding records from role_menu table you can see the jstree structure and tables in attachment. If I remove individual child from its parent then if last one is remaining then parent should also removed from role_menu. How to check or count last child.
Role_Menu
JSTREE
Menus