public function queryHandler()
    {
        /** @var array $materialIds Array of identifiers of suitable materials */
        $materialIds = array();

        // Fill our recently declared array
        $matIdQuery = dbQuery(NavigationMaterial::class);
        if (!empty($this->nav)) {

            $childStructures = array($this->nav->id);
            $stepChildren = array($this->nav->id);

            while (
            dbQuery('structure_relation')
                ->cond('parent_id', $stepChildren)
                ->fields('child_id', $stepChildren)
            ) {
                $childStructures = array_merge($childStructures, $stepChildren);
            }

            $matIdQuery->cond('StructureID', $childStructures);
        }
        $matIdQuery->cond('Active', 1)->fields('MaterialID', $materialIds);

        // Add this identifiers as query condition if they exist
        empty($materialIds) ? $this->query->id(0) : $this->query->id($materialIds);
    }