private function countItems(string $identifier, array $array = []): int
    {
        if (! $array) {
            $array   = $this->toArray($this->all($identifier));
            $counter = count($array);
        } else {
            $counter = 0;
        }

        foreach ($array as $value) {
            $counter += count($value['children']);

            if ($value['children']) {
                $counter += $this->countItems($identifier, $value['children']);
            }
        }

        return $counter;
    }