public function processCategories($contact, $categoryIds)
    {
        $contact->getCategories()->clear();

        if (!$categoryIds) {
            return true;
        }

        foreach ($categoryIds as $categoryId) {
            $category = $this->em->getRepository(self::$categoryEntityName)->find($categoryId);

            if (!$category) {
                throw new EntityNotFoundException(self::$categoryEntityName, $categoryId);
            }

            $contact->addCategory($category);
        }

        return true;
    }