private function removeFromCollection(&$collection, $items)
    {
        if (is_array($collection)) {
            foreach ($items as $item) {
                foreach ($collection as $index => $v) {
                    if (spl_object_hash($item) == spl_object_hash($v)) {
                        unset($collection[$index]);
                    }
                }
            }
        } else {
            foreach ($items as $item) {
                $collection->removeElement($item);
            }
        }
    }