Fixed configuration and tests and refactered dehydration of the user ent...

...ity