class DynamoDBManager {

    public static TableDescription createTable(final AmazonDynamoDB dynamoDB, final CreateTableRequest request) {
        try {
            final DescribeTableResult result = dynamoDB.describeTable(request.getTableName());
            if (!request.getKeySchema().equals(result.getTable().getKeySchema())) {
                throw new IllegalStateException("Table " + request.getTableName()
                    + " already exists and has an invalid schema");
            }
            LOGGER.warning("Table " + request.getTableName() + " already exists");
            return result.getTable();
        } catch (final ResourceNotFoundException e) {
            return dynamoDB.createTable(request).getTableDescription();
        }
    }

    private  DynamoDBManager();

}