public function removeEntry(PoEntry $entry): bool
    {
        $key = $this->createKeyFromEntry($entry);

        // try by the key first.
        if (!empty($key) && isset($this->entries[$key])) {
            if ($entry === $this->entries[$key]) {
                unset($this->entries[$key]);
                return true;
            }
        }

        // the entry can't be matched by key, so we have to loop :(
        foreach ($this->entries as $key => $value) {
            if ($entry === $value) {
                unset($this->entries[$key]);
                return true;
            }
        }

        // no match found in main entries, try the unkeyedEntries
        foreach ($this->unkeyedEntries as $key => $value) {
            if ($entry === $value) {
                unset($this->unkeyedEntries[$key]);
                return true;
            }
        }

        return false;
    }