private void checkPreconditions(String name, ContainerStatus status, boolean encrypted, boolean previouslyEncrypted) {
    if (name == null || status == null) {
      throw new IllegalStateException("Either of required fields name=" + name + " or status=" + status + " is null");
    }
    if (encrypted && !previouslyEncrypted) {
      throw new IllegalStateException("previouslyEncrypted should be true if the container is currently encrypted");
    }
  }
Checks if any required fields is missing for a {@link Container} or for any incompatible settings.
@param name The name of the container. Cannot be null.
@param status The status of the container. Cannot be null.
@param encrypted {@code true} if blobs in the {@link Container} should be encrypted, {@code false} otherwise.
@param previouslyEncrypted {@code true} if this {@link Container} was encrypted in the past, or currently, and a
                           subset of blobs in it could still be encrypted.
ambry-api/src/main/java/com/github/ambry/account/Container.java