JCR-2283: Cannot create new user on a preloaded database with 10 thousands of users

Fix description:
- Use loop instead of using recursive function.