Help with a component removing no longer valid entities

Hi everyone.
I have a semi working component that pulls data from a cloud based API. Its pretty simple and theres not much to it.

For each item in the API response, i create a sensor. When a new item appears, a new sensor is created, thats working as expected.
However, how do i remove a sensor thats no longer in the response ?

Im sure this is a question thats been asked and answered before, I just didnt have any luck finding anything, maybe because im searching for the wrong thing.

I don’t think that there is a built-in function to take care of this. However, the scenario that you describe is common to all geolocation integrations, and what I did to handle this was to implement a manager component that keeps track of the current and the previous state to identify which entities to create vs. update vs. remove. This works reasonably well, so maybe have a look at one of those integrations and their libraries for some inspiration.