public function createGraph(Graph $graph)
    {
        $edgeDefinitions = [];
        foreach ($graph->getEdgeDefinitions() as $ed) {
            $edgeDefinitions[] = $ed->transformToArray();
        }

        $params   = [
            self::OPTION_NAME               => $graph->getKey(),
            self::OPTION_EDGE_DEFINITIONS   => $edgeDefinitions,
            self::OPTION_ORPHAN_COLLECTIONS => $graph->getOrphanCollections()
        ];
        $url      = Urls::URL_GRAPH;
        $response = $this->getConnection()->post($url, $this->json_encode_wrapper($params));
        $json     = $response->getJson();
        $graph->setInternalId($json['graph'][Graph::ENTRY_ID]);
        $graph->set(Graph::ENTRY_KEY, $json['graph'][self::OPTION_NAME]);
        $graph->setRevision($json['graph'][Graph::ENTRY_REV]);

        return $graph->getAll();
    }