public function searchUsersAction()
    {
        if (!$this->getRequest()->isXmlHttpRequest()) {
            throw new \RuntimeException('This action must be called via ajax request');
        }
        
        $model = new JsonModel();
        $query = $this->params()->fromPost('query', false);
        if (!$query) {
            $query = $this->params()->fromQuery('q', false);
        }
        if (false === $query) {
            $result = array();
        } else {
            $repositories = $this->repositories;
            $repository   = $repositories->get('Auth/User');
            
            $users = $repository->findByQuery($query);
        
            $userFilter = $this->filterManager->get('Auth/Entity/UserToSearchResult');
            $filterFunc = function ($user) use ($userFilter) {
                return $userFilter->filter($user);
            };
            $result     = array_values(array_map($filterFunc, $users->toArray()));
        }
        
        //$model->setVariable('users', $result);
        $model->setVariables($result);
        return $model;
    }