private function getMaxIdx($parentId = 0, $lessThen = false)
    {
        $query = call_user_func("$this->ownerClassName::find")
            ->select("MAX($this->sortField)");
        if ( $lessThen !== false ) {
            $query->where([ '<', $this->sortField, $lessThen ]);
        }
        if ( $this->parentIdField ) {
            $query->andWhere([ $this->parentIdField => $parentId ]);
        }
        $result = $query->scalar();
        if ( $result === null ) {
            $result = floor($lessThen / 2);
        }
        return (int)$result;
    }