public function updateTag($tagPath, Request $request)
    {
        $tagUpdateStruct = $this->inputDispatcher->parse(
            new Message(
                ['Content-Type' => $request->headers->get('Content-Type')],
                $request->getContent()
            )
        );

        $tag = $this->tagsService->loadTag(
            $this->extractTagIdFromPath($tagPath)
        );

        $updatedTag = $this->tagsService->updateTag($tag, $tagUpdateStruct);

        $childrenCount = 0;
        $synonymsCount = 0;

        if (empty($updatedTag->mainTagId)) {
            $childrenCount = $this->tagsService->getTagChildrenCount($updatedTag);
            $synonymsCount = $this->tagsService->getTagSynonymCount($updatedTag);
        }

        return new Values\RestTag(
            $updatedTag,
            $childrenCount,
            $synonymsCount
        );
    }