Static analyzer fixes.
Fix overwrite of communities array on setCredentials for a user that already has communities.
Remove debug code
Fixed code issues.