public function addEdgeDefinition($graph, $edgeDefinition)
    {
        if ($graph instanceof Graph) {
            $graph = $graph->getKey();
        }

        $url  = UrlHelper::buildUrl(Urls::URL_GRAPH, [$graph, Urls::URLPART_EDGE]);
        $data = $edgeDefinition->transformToArray();

        try {
            $response = $this->getConnection()->post($url, $this->json_encode_wrapper($data));

        } catch (Exception $e) {
            throw new ClientException($e->getMessage());
        }

        $data = $response->getJson();

        $options['_isNew'] = false;

        $result = Graph::createFromArray($data['graph'], $options);
        $result->set(Graph::ENTRY_KEY, $data['graph'][self::OPTION_NAME]);

        return $result;
    }