B-56184 code changes to store correct client instance id in user manager, refactoring test to remove test code duplication