public function loadGroups(EventInterface $event) {
        $query = new GroupQuery();
        $params = $event->getRequest()->query;

        if ($params->has('page')) {
            $query->page($params->get('page'));
        }

        if ($params->has('limit')) {
            $query->limit($params->get('limit'));
        }

        $response = $event->getResponse();
        $aclAdapter = $event->getAccessControl();

        // Create the model and set some pagination values
        $model = new GroupsModel();
        $model->setLimit($query->limit())
              ->setPage($query->page());

        $groups = $aclAdapter->getGroups($query, $model);
        $modelGroups = [];

        foreach ($groups as $groupName => $resources) {
            $modelGroups[] = [
                'name' => $groupName,
                'resources' => $resources,
            ];
        }

        $model->setGroups($modelGroups);
        $response->setModel($model);
    }