public function calculateTotal(Paper $paper)
    {
        $total = 0;

        $structure = json_decode($paper->getStructure(), true);

        foreach ($structure['steps'] as $step) {
            foreach ($step['items'] as $item) {
                if (1 === preg_match('#^application\/x\.[^/]+\+json$#', $item['type'])) {
                    $total += $this->itemManager->calculateTotal($item);
                }
            }
        }

        return $total;
    }