Not sure this enough. You likely need to clean the appsByOrigin array if the user uninstall the application no?