public function create($collection, array $options = [])
    {
        if (is_string($collection)) {
            $name       = $collection;
            $collection = new Collection();
            $collection->setName($name);
            foreach ($options as $key => $value) {
                $collection->{'set' . ucfirst($key)}($value);
            }
        }
        if ($collection->getWaitForSync() === null) {
            $collection->setWaitForSync($this->getConnectionOption(ConnectionOptions::OPTION_WAIT_SYNC));
        }

        if ($collection->getJournalSize() === null) {
            $collection->setJournalSize($this->getConnectionOption(ConnectionOptions::OPTION_JOURNAL_SIZE));
        }

        if ($collection->getIsSystem() === null) {
            $collection->setIsSystem($this->getConnectionOption(ConnectionOptions::OPTION_IS_SYSTEM));
        }

        if ($collection->getIsVolatile() === null) {
            $collection->setIsVolatile($this->getConnectionOption(ConnectionOptions::OPTION_IS_VOLATILE));
        }

        $type   = $collection->getType() ?: Collection::getDefaultType();
        $params = [
            Collection::ENTRY_NAME         => $collection->getName(),
            Collection::ENTRY_TYPE         => $type,
            Collection::ENTRY_WAIT_SYNC    => $collection->getWaitForSync(),
            Collection::ENTRY_JOURNAL_SIZE => $collection->getJournalSize(),
            Collection::ENTRY_IS_SYSTEM    => $collection->getIsSystem(),
            Collection::ENTRY_IS_VOLATILE  => $collection->getIsVolatile(),
            Collection::ENTRY_KEY_OPTIONS  => $collection->getKeyOptions(),
        ];

        // set extra cluster attributes
        if ($collection->getNumberOfShards() !== null) {
            $params[Collection::ENTRY_NUMBER_OF_SHARDS] = $collection->getNumberOfShards();
        }
        
        if ($collection->getReplicationFactor() !== null) {
            $params[Collection::ENTRY_REPLICATION_FACTOR] = $collection->getReplicationFactor();
        }
        
        if ($collection->getShardingStrategy() !== null) {
            $params[Collection::ENTRY_SHARDING_STRATEGY] = $collection->getShardingStrategy();
        }

        if (is_array($collection->getShardKeys())) {
            $params[Collection::ENTRY_SHARD_KEYS] = $collection->getShardKeys();
        }

        $response = $this->getConnection()->post(Urls::URL_COLLECTION, $this->json_encode_wrapper($params));

        //    $location = $response->getLocationHeader();
        //    if (!$location) {
        //      throw new ClientException('Did not find location header in server response');
        //    }
        $jsonResponse = $response->getJson();
        $id           = $jsonResponse['id'];
        $collection->setId($id);

        return $id;
    }