public ResponseMessage <User> Create(RegisterUserRequest data)
        {
            //TODO: RegisterUserRequest beletenni minden olyan tulajdonsagot ami szukseges a User es a Profile objektumok letrehozasara
            ResponseMessage <User> response = new ResponseMessage <User>();

            try
            {
                User user = new User(data);
                user.Password           = PasswordHasher.Create(data.Password, data.Email);
                user.PublicID           = UniqKeyGenerator.Generate();
                response.ResponseObject = _userRepository.Create(user);

                Profile profile = data.ConvertTo <Profile>();
                profile.ID = user.PublicID;
                _profileRepository.Create(profile);


                response.IsSuccess    = true;
                response.ErrorMessage = "Success";
            }
            catch (Exception ex)
            {
                response.IsSuccess    = false;
                response.ErrorMessage = ex.Message;
            }

            return(response);
        }
        public ResponseMessage <User> Create(RegisterUserRequest data)
        {
            ResponseMessage <User> response = new ResponseMessage <User>();

            try
            {
                //check if the user exists
                bool exist = _userRepository.FindEmail(data.Email);

                //if exist throw exeption
                if (exist == true)
                {
                    throw new Exception($"{data.Email} already taken!");
                }

                User user = new User(data);
                user.Password           = PasswordHasher.Create(data.Password, data.Email);
                user.PublicID           = UniqKeyGenerator.Generate();
                user.Role               = UserRole.User.ToString();
                data.Role               = UserRole.User.ToString();
                response.ResponseObject = _userRepository.Create(user);

                //create the profile
                Profile profile = new Profile(user.PublicID, data);
                response.IsSuccess = _profileRepository.Create(profile);

                //SendWelcomeEmail(user.Email);
            }
            catch (Exception ex)
            {
                response.ErrorMessage = ex.Message;
                response.IsSuccess    = false;
            }

            return(response);
        }