public function updateOrAdd(LineInterface $line)
    {
        $key = $line->key();

        $index = $this->search(function (LineInterface $line) use ($key) {
            return $line->key() == $key;
        });

        if ($index > -1) {
            $this->put($index, $line);
        } else {
            $this->add($line);
        }
    }