Refactored register model again.

Moved password generation into user entity.

Moved checking for duplicates into db call.