Avoid unnecessary queries to DB.

Collect IDs from users to be removed and then removed 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.
Merge pull request #913 from andrezrv/av-master

Avoid unnecessary queries to DB.