Added user validation and registration to be saved into database