public StoreNewUserResponse Any(StoreNewUser request)
        {
            var existingUsers = Db.Select<User>(q => q.UserName == request.UserName);

            if (existingUsers.Count > 0)
            {
                return new StoreNewUserResponse
                {
                    ResponseStatus = new ResponseStatus
                    {
                        ErrorCode = ErrorAlreadyExists,
                        Message = ErrorAlreadyExists.ToEnglish()
                    }
                };
            }

            var newUser = new User
            {
                UserName = request.UserName,
                Email = request.Email,
                Password = request.Password,
                GlobalId = Guid.NewGuid(),
            };

            Db.Save(newUser);

            return new StoreNewUserResponse { UserId = newUser.Id };
        }
        public void StoreNewUser_Test()
        {
            using (var db = ConnectionFactory.Open())
            {
                var service = appHost.Resolve<StoreNewUserService>();

                var newUserRequest = new StoreNewUser
                {
                    UserName = "******",
                    Email = "*****@*****.**",
                    Password = "******"
                };
                var response = service.Any(newUserRequest);

                var storedUser = db.SingleFmt<User>("UserName = {0}", newUserRequest.UserName);
                Assert.That(storedUser.Id, Is.EqualTo(response.UserId));
                Assert.That(storedUser.Email, Is.EqualTo(newUserRequest.Email));
                Assert.That(storedUser.Password, Is.EqualTo(newUserRequest.Password));
            }
        }
		private void DatabaseTest(IDbConnectionFactory connectionFactory)
		{
			ConfigureDatabase.Init(connectionFactory);

			var storeRequest = new StoreNewUser {
				Email = "new@email",
				Password = "******",
				UserName = "******"
			};

            var storeHandler = Container.Resolve<StoreNewUserService>();
			storeHandler.Any(storeRequest);

            var getAllHandler = Container.Resolve<GetAllUsersService>();
            var response = (GetAllUsersResponse)getAllHandler.Any(new GetAllUsers());

			var user = response.Users[0];

			System.Console.WriteLine("Stored and retrieved user: {0}, {1}, {2}",
				user.Id, user.UserName, user.Email);
		}