private Pair<Account, Collection<Container>> updateContainers(RetainingAsyncWritableChannel channel)
        throws RestServiceException {
      Short accountId = RestUtils.getNumericalHeader(restRequest.getArgs(), RestUtils.Headers.TARGET_ACCOUNT_ID, false,
          Short::parseShort);
      String accountName = RestUtils.getHeader(restRequest.getArgs(), RestUtils.Headers.TARGET_ACCOUNT_NAME, false);
      if (accountId == null && accountName == null) {
        throw new RestServiceException("Missing required header: " + RestUtils.Headers.TARGET_ACCOUNT_NAME,
            RestServiceErrorCode.BadRequest);
      }
      Account account =
          accountName != null ? accountService.getAccountByName(accountName) : accountService.getAccountById(accountId);
      if (account == null) {
        throw new RestServiceException("Account not found: " + accountName, RestServiceErrorCode.NotFound);
      }
      accountId = account.getId();
      accountName = account.getName();

      Collection<Container> containersToUpdate;
      try {
        containersToUpdate =
            AccountCollectionSerde.containersFromInputStreamInJson(channel.consumeContentAsInputStream(),
                accountId);
      } catch (IOException e) {
        throw new RestServiceException("Bad container update request body", e, RestServiceErrorCode.BadRequest);
      }
      try {
        Collection<Container> updatedContainers = accountService.updateContainers(accountName, containersToUpdate);
        return new Pair<>(account, updatedContainers);
      } catch (AccountServiceException ex) {
        throw new RestServiceException("Container update failed for accountId " + accountId,
            RestServiceErrorCode.getRestServiceErrorCode(ex.getErrorCode()));
      }
    }
Process the request json and call {@link AccountService#updateContainers} to add or update containers.
@param channel The {@link RetainingAsyncWritableChannel} to read the bytes out
@return a pair of account and its updated containers.
@throws RestServiceException
ambry-frontend/src/main/java/com/github/ambry/frontend/PostAccountsHandler.java