public static Collection<Container> containersFromInputStreamInJson(InputStream inputStream, short accountId)
      throws IOException {
    Map<String, Collection<Container>> map =
        objectMapper.readValue(inputStream, new TypeReference<Map<String, Collection<Container>>>() {
        });
    if (!map.containsKey(Account.CONTAINERS_KEY)) {
      return Collections.emptyList();
    } else {
      Collection<Container> containers = map.get(Account.CONTAINERS_KEY);
      return containers.stream()
          .map(c -> new ContainerBuilder(c).setParentAccountId(accountId).build())
          .collect(Collectors.toList());
    }
  }
Deserialize a collection of {@link Container}s in json from given InputStream.
@param inputStream the {@link InputStream} that contains serialized json bytes.
@param accountId the account id for these containers.
@return a {@link Collection} of {@link Container}s.
ambry-api/src/main/java/com/github/ambry/account/AccountCollectionSerde.java