Avoid unnecessary queries to DB.

Collect IDs from users to be removed and then remove the users and their metadata in single queries, instead of running two queries for every user. This is much faster and reduces memory consumption when you have big quantities of users that haven't been deleted previously.