private function countStackMessages(Stack $stack)
    {
        return 1 + array_sum(array_map(function (Stack $child) {
            return $this->countStackMessages($child);
        }, $this->getChildrenStacks($stack)));
    }