You seem to be doing this same basic thing a lot. It might be good to extract this out. Also, this entire thing might be better served as a validation that you're doing when creating the user object.