public static byte[] serializeAccountsInJson(Collection<Account> accounts, boolean ignoreContainers)
      throws IOException {
    Map<String, Collection<Account>> resultObj = new HashMap<>();
    resultObj.put(ACCOUNTS_KEY, accounts);
    return ignoreContainers ? objectMapperWithoutContainer.writeValueAsBytes(resultObj)
        : objectMapper.writeValueAsBytes(resultObj);
  }
Serialize a collection of accounts to json bytes that can be used in requests/responses.
@param accounts         the {@link Account}s to serialize.
@param ignoreContainers  {@code true} to ignore containers in the serialization, {@code false} otherwise.
@return the serialized bytes in json format.
ambry-api/src/main/java/com/github/ambry/account/AccountCollectionSerde.java