Commit additional entities, added from child EditScreen,on parent EditScreen commit only

I have MinistryEdit. Inside it I have composition CardEdit. Card has user inside of it. user is SecUser. Inisde CardEdit I have following code:

 @Override
    protected void postInit() {
        super.postInit();
        if (getItem().getUser() == null) { //PersistenceHelper.isNew(getItem())
            // create user
            User user = metadata.create(User.class);
            getItem().setUser(user);
            CallbookConfig callbookConfig = configuration.getConfig(CallbookConfig.class);
            Group UserGroup = dataManager.load(LoadContext.create(Group.class).setId(UUID.fromString(callbookConfig.getUserGroupId())));
            Role userRole = dataManager.load(LoadContext.create(Role.class).setId(UUID.fromString(callbookConfig.getUserRoleID())));
            user.setGroup(UserGroup);
            UserRole uR = metadata.create(UserRole.class);
            uR.setUser(user);
            uR.setRole(userRole);
            if (user.getUserRoles() == null) {
                List<UserRole> userRoles = new ArrayList<>();
                user.setUserRoles(userRoles);
            }
            user.getUserRoles().add(uR);

            getDsContext().getParent().addBeforeCommitListener(context -> {
                if(context.getCommitInstances().contains(getItem())) {
                    context.addInstanceToCommit(uR);
                    user.setPassword(passwordEncryption.getPasswordHash(user.getId(), pwdFld.getRawValue()));
                }
                });
        } 
    }

So when
1)User opens MinistryEdit
2)User creates a Card from table in MinistryEdit (clicks ok in CardEdit)
3)But user clicks CANCEL in ministyEdit
Card is NOT saved (as expected) but newly created UserGroup and User are SAVED.
How do I save UserGroup and User only if correpoding card is saved?
Ask for clarification please if question is not clear…

Consder it solved. From CardEdit:
((CollectionDatasource<UserRole,UUID>)getParentDs().getDsContext().getNN("userRolesDs")).modifyItem(uR);
Whereas in MinistryEdit:
image