public function createContainer($properties = [], $check_exist = false)
    {
        $container = array_get($properties, 'name', array_get($properties, 'path'));
        if (empty($container)) {
            throw new BadRequestException('No name found for container in create request.');
        }
        // does this folder already exist?
        if ($this->folderExists($container, '')) {
            if ($check_exist) {
                throw new BadRequestException("Container '$container' already exists.");
            }
        } else {
            // create the container
            $dir = static::addContainerToName($container, '');

            if (!mkdir($dir, 0777, true)) {
                throw new InternalServerErrorException('Failed to create container.');
            }
        }

        return ['name' => $container, 'path' => $container];

//            $properties = (empty($properties)) ? '' : json_encode($properties);
//            $result = file_put_contents($key, $properties);
//            if (false === $result) {
//                throw new InternalServerErrorException('Failed to create container properties.');
//            }
    }