I have a flat list of items. Some of the items in the list are parents of other items in the list. I need to go through each item, and make sure it's not invalid. Each item has an expiration time, and an item is invalid if it's own or any of it's parent's expiration times have passed. How can I efficiently remove all invalid items from the list?I have a flat list of items. Some of the items