code: private void switchAccountStatusTree(Account parentAccount,
              UserIdentityContext userIdentityContext) {
          logger.debug("Status transition requested");
          // transition child accounts
          List<String> subAccountsToSwitch = accountsDao.getSubAccountSidsRecursive(parentAccount.getSid());
          if (subAccountsToSwitch != null && !subAccountsToSwitch.isEmpty()) {
              int i = subAccountsToSwitch.size(); // is is the count of accounts left to process
              // we iterate backwards to handle child accounts first, parent accounts next
              while (i > 0) {
                  i --;
                  String removedSid = subAccountsToSwitch.get(i);
                  try {
                      Account subAccount = accountsDao.getAccount(new Sid(removedSid));
                      switchAccountStatus(subAccount, parentAccount.getStatus(), userIdentityContext);
                  } catch (Exception e) {
                      // if anything bad happens, log the error and continue removing the rest of the accounts.
                      logger.error("Failed switching status (child) account '" + removedSid + "'");
                  }
              }
          }
          // switch parent account too
          switchAccountStatus(parentAccount, parentAccount.getStatus(), userIdentityContext);
      }
docs: Switches status of account along with all its children (the whole tree).
  
  @param parentAccount