@Override
  public Collection<Container> updateContainers(String accountName, Collection<Container> containers)
      throws AccountServiceException {
    // input validation
    if (accountName == null || accountName.isEmpty() || containers == null || containers.isEmpty()) {
      throw new AccountServiceException("Account or container is null or empty", AccountServiceErrorCode.BadRequest);
    }
    Account account = getAccountByName(accountName);
    if (account == null) {
      throw new AccountServiceException("Account " + accountName + " is not found", AccountServiceErrorCode.NotFound);
    }

    List<Container> createdContainers = new ArrayList<>();
    short nextContainerId = account.getAllContainers()
        .stream()
        .map(Container::getId)
        .max(Short::compareTo)
        .map(maxId -> (short) (maxId + 1))
        .orElse((short) 1);
    // construct containers based on input container and next containerId
    for (Container container : containers) {
      createdContainers.add(
          new ContainerBuilder(container).setId(nextContainerId).setParentAccountId(account.getId()).build());
      ++nextContainerId;
    }
    account.updateContainerMap(createdContainers);
    updateAccounts(Collections.singletonList(account));
    return createdContainers;
  }
Constructor.
@param shouldReturnOnlyUnknown {@code true} if always returns {@link InMemAccountService#UNKNOWN_ACCOUNT} when queried
                                                    by account name; {@code false} to do the actual query.
@param notifyConsumers {@code true} if consumers should be notified of account changes. {@code false} otherwise.
ambry-test-utils/src/main/java/com/github/ambry/account/InMemAccountService.java