Change the way JTableUser::store saves groups

See http://issues.joomla.org/tracker/joomla-cms/5138

If JTable::store() happens on the same user concurrently, it will eventually lead to loss of #__user_usergroup_map rows for that user. Because JTable::store() deletes everything from #__user_usergroup_map and then re-adds one by one, if that process happens multiple times in parallel for the same user, the inserts and deletes get mixed up.

This is a fix for this, that instead of performing "delete and re-insert one by one", grabs the records from the database, loops through them, decides which should stay and which should go based on $this->groups and then adds new ones (if any) from $this->groups
Don't use `sizeof`, use `count`