private function resolvePrice(array $entry, $weight)
    {
        $price = $count = 0;

        if ($weight > $entry['max_weight']) {
            $count = floor($weight / $entry['max_weight']);
            $weight = round(fmod($weight, $count), 3);
        }

        if (0 < $count) {
            $max = end($entry['prices'])['price'];
            $price = $count * $max;
        }

        foreach ($entry['prices'] as $p) {
            // If sale weight is lower than price weight
            if (1 === bccomp($p['weight'], $weight, 3)) {
                $price += $p['price'];
                break;
            }
        }

        return $price;
    }