public Account build() {
    if (id == null) {
      throw new IllegalStateException("Account id is not present");
    }
    // Did we check the container parent account id here?
    for (Map.Entry<Short, Container> entry : idToContainerMetadataMap.entrySet()) {
      if (entry.getValue().getParentAccountId() == Container.UNKNOWN_CONTAINER_PARENT_ACCOUNT_ID) {
        entry.setValue(new ContainerBuilder(entry.getValue()).setParentAccountId(id).build());
      } else {
        entry.setValue(new ContainerBuilder(entry.getValue()).build());
      }
    }
    return new Account(id, name, status, aclInheritedByContainer, snapshotVersion, idToContainerMetadataMap.values(),
        lastModifiedTime, quotaResourceType);
  }
Builds an {@link Account} object. {@code id}, {@code name}, {@code status}, {@code lastModifiedTime} and
{@code containers} (if any) must be set before building.
@return An {@link Account} object.
@throws IllegalStateException If any required fields is not set or there is inconsistency in containers.
ambry-api/src/main/java/com/github/ambry/account/AccountBuilder.java