protected function getGroupMap(array $limitIds = null)
    {
        $query = $this->dbHandler->createSelectQuery();
        $query->select(
            $this->dbHandler->quoteColumn('identifier', 'ezcobj_state_group'),
            $this->dbHandler->quoteColumn('id', 'ezcobj_state')
        )->from(
            $this->dbHandler->quoteTable('ezcobj_state')
        )->innerJoin(
            $this->dbHandler->quoteTable('ezcobj_state_group'),
            $query->expr->eq(
                $this->dbHandler->quoteColumn('group_id', 'ezcobj_state'),
                $this->dbHandler->quoteColumn('id', 'ezcobj_state_group')
            )
        );

        if ($limitIds !== null) {
            $query->where(
                $query->expr->in(
                    $this->dbHandler->quoteColumn('id', 'ezcobj_state'),
                    array_map('intval', $limitIds)
                )
            );
        }

        $statement = $query->prepare();
        $statement->execute();

        $map = array();
        $groupValues = $statement->fetchAll(\PDO::FETCH_ASSOC);
        foreach ($groupValues as $groupValue) {
            $map[self::STATE_GROUP . $groupValue['identifier']][] = (int)$groupValue['id'];
        }

        return $map;
    }