For a collaborative website for a company, user ID of a given user is stored in another user's meta data. For e.g.: If user A is collaborating with user B, the user ID of user A is appended to an array that contains several other user ID's and then
update_user_meta is run to store the array in user B's meta data. However, when user A leaves the company his account is deleted. The action deletes the user ID from the WordPress system however the ID remains in the array stored in user B's meta data. When looking at larger scale user A's ID may appear in several other user's meta data. Since, this is a continual process there are many users having ID's of non-existent users in their meta data. This is increasing size of the arrays stored in the meta data for no reason. And the non-existent ID's keep throwing errors wherever the data is used within the site. Leading to a whole lot of mess. Though conditionals are used within the code to check for user ID existence in WordPress, there is no reason to continue storing these irrelevant ID's.
So the question is: How, can I remove non-existent user ID's from meta data of active users?