// Create a list of ActionGroups associated with the user by retrieving each role's ActionGroups
  // (and proceed to Step4).
  // Use only as 'Step3' of 'UpdateIsENGINEUser'
  public void UpdateUserActionGroups(Object targetObject, java.util.ArrayList<Guid> roleIdList) {
    for (Guid roleID : roleIdList) {
      AsyncDataProvider.GetRoleActionGroupsByRoleId(
          new AsyncQuery(
              targetObject,
              new INewAsyncCallback() {
                @Override
                public void OnSuccess(Object target, Object returnValue) {

                  UserPortalLoginModel loginModel = (UserPortalLoginModel) target;
                  java.util.ArrayList<ActionGroup> roleActionGroupList =
                      (java.util.ArrayList<ActionGroup>) returnValue;
                  for (ActionGroup actionGroup : roleActionGroupList) {
                    if (!loginModel.getLoggedUserActionGroupList().contains(actionGroup)) {
                      loginModel.getLoggedUserActionGroupList().add(actionGroup);
                    }
                  }
                  loginModel.setRolesCounter(loginModel.getRolesCounter() - 1);
                  if (loginModel.getRolesCounter() == 0) {
                    CheckIsENGINEUser(loginModel);
                  }
                }
              }),
          roleID);
    }
  }
  // Update IsENGINEUser flag.
  // Get 'ENGINEUser' role's ActionGroups (and proceed to Step2).
  public void UpdateIsENGINEUser(VdcUser LoggedUser) {
    setENGINEUserActionGroupList(new java.util.ArrayList<ActionGroup>());
    this.setLoggedUser(LoggedUser);

    AsyncDataProvider.GetRoleActionGroupsByRoleId(
        new AsyncQuery(
            this,
            new INewAsyncCallback() {
              @Override
              public void OnSuccess(Object target, Object returnValue) {

                UserPortalLoginModel loginModel = (UserPortalLoginModel) target;
                loginModel.setENGINEUserActionGroupList(
                    (java.util.ArrayList<ActionGroup>) returnValue);
                loginModel.GetUserRoles(loginModel);
              }
            }),
        new Guid(ENGINEUserRoleId));
  }