public function saveReference(ViewReference $viewReference, $parentId = null, $parentLocale = null)
    {
        // Transform the viewReference in array
        $arrayTransformer = $this->transformer->getViewReferenceTransformer(
            $viewReference->getViewNamespace(), 'array'
        );
        $referenceArray = $arrayTransformer->reverseTransform($viewReference);
        // Remove old url if exist
        $this->removeUrlForViewReference($viewReference);
        // Update/create the viewReference
        $this->manager->update($referenceArray['id'], $referenceArray);
        // Build the url for reference
        $this->manager->buildUrl($viewReference->getId());
        // Set parent if exist
        if ($parentId && $parentLocale === $viewReference->getLocale()) {
            $this->manager->addChild($parentId, $referenceArray['id']);
        }

        return $referenceArray['id'];
    }