public function customAction($entity, $action, $id = null, Request $request)
    {
        $entityConfig = $this->get('lin3s_admin.configuration.factory.entity')->createFor($entity);
        $entityObject = null;
        $repository = $this->get($entityConfig->repositoryServiceId());
        $entityConfig->loadRepository($repository);

        if ($id) {
            $entityObject = $repository->find($entityConfig, $id);
        }
        if ($id && !$entityObject) {
            throw $this->createNotFoundException(
                sprintf(
                    '%s not found for id "%s"',
                    $entityConfig->name(),
                    $id
                )
            );
        }
        try {
            $callableAction = $entityConfig->getAction($action);
        } catch (\Exception $e) {
            throw $this->createNotFoundException(
                sprintf(
                    'Action "%s" for entity "%s" not found, did you registered it in the config?',
                    $action,
                    $entity
                )
            );
        }

        return $callableAction->execute($entityObject, $entityConfig, $request);
    }