public long RegisterUser(string loginName, string clearPassword, UserProfileDetails userProfileDetails) { try { UserProfileDao.FindByLoginName(loginName); throw new DuplicateInstanceException(loginName, typeof(UserProfile).FullName); } catch (InstanceNotFoundException) { String encryptedPassword = PasswordEncrypter.Crypt(clearPassword); UserProfile userProfile = new UserProfile(); userProfile.loginName = loginName; userProfile.enPassword = encryptedPassword; userProfile.firstName = userProfileDetails.FirstName; userProfile.lastName = userProfileDetails.Lastname; userProfile.email = userProfileDetails.Email; userProfile.language = userProfileDetails.Language; userProfile.country = userProfileDetails.Country; UserProfileDao.Create(userProfile); return(userProfile.usrId); } }