public function deleteWidget(Widget $widget, View $view)
    {
        //we update the widget map of the view
        $this->widgetMapBuilder->build($view);
        $widgetMap = $widget->getWidgetMap();
        //the widget is removed only if the current view is the view of the widget
        if ($widgetMap->getView() == $view && $widgetMap->getAction() != WidgetMap::ACTION_DELETE) {
            //we remove the widget
            $this->entityManager->remove($widget);
        }

        //update the view deleting the widget
        $this->widgetMapManager->delete($view, $widget);

        //we update the view
        $this->entityManager->persist($view);

        $this->entityManager->flush();
    }