public function count($load = true)
    {
        //if query is set, and the data is not loaded
        //lets use the query to get the count
        if (isset($this->_query) && !$this->isLoaded() && !$load) {
            $query = AnDomainQuery::getInstance($this->getRepository(), $this->_query);

            return $query->fetchValue('count(*)');
        } else {
            $this->_loadData();
            $result = parent::count();
        }

        return $result;
    }