public function createNewCustomFilter($filterName, $routeName, $routeParameters, $filterParameters, $user = null)
    {
        $newFilter = new CustomFilter();
        $newFilter
            ->setName($filterName)
            ->setRouteName($routeName)
            ->setRouteParameters(json_encode($routeParameters, JSON_UNESCAPED_SLASHES))
            ->setFilterParameters(json_encode($filterParameters, JSON_UNESCAPED_SLASHES))
            ->setUser($user)
        ;

        $this->_em->persist($newFilter);
        $this->_em->flush($newFilter);

        return $newFilter;
    }