private function handleOverwrite(KeywordInterface $keyword, CategoryInterface $category)
    {
        if (null !== $synonym = $this->findSynonym($keyword)) {
            // reset entity and remove it from category
            if ($this->entityManager->contains($keyword)) {
                $this->entityManager->refresh($keyword);
            }
            $this->delete($keyword, $category);

            // link this synonym to the category
            $keyword = $synonym;
        }

        $categoryTranslation = $category->findTranslationByLocale($keyword->getLocale());
        if (!$categoryTranslation) {
            $categoryTranslation = $this->createTranslation($category, $keyword->getLocale());
        }

        // if keyword already exists in category
        if ($categoryTranslation->hasKeyword($keyword)) {
            return $keyword;
        }

        $keyword->addCategoryTranslation($categoryTranslation);
        $categoryTranslation->addKeyword($keyword);

        // FIXME category and meta will not be updated if only keyword was changed
        $category->setChanged(new \DateTime());
        $categoryTranslation->setChanged(new \DateTime());

        return $keyword;
    }