public AccountModule(IAccountService accountService, IHttpContextAccessor httpContextAccessor)
        {
            this.context = httpContextAccessor.Current;

            Post["/Account/Create"] = x =>
                                          {
                                              var command = new AddUserAccountCommand(Request.Form.EmailAddress,
                                                                                  Request.Form.Password,
                                                                                  uint.Parse(Request.Form.RateOutOf));
                                              var account = accountService.CreateAccount(command);

                                              var accountValidationUrl = context.Request.BaseUrl() + "/Account/Validate/" + account.Key;

                                              return Response.AsJson(new
                                                                         {
                                                                             AccountKey = account.Key,
                                                                             AccountValidationUrl = accountValidationUrl
                                                                         });
                                          };

            Post["/Account/Validate"] = x =>
                                                           {
                                                               var command = new ValidateAccountCommand(Request.Form.ValidationKey);
                                                               return Response.AsJson((int)accountService.ValidateAccount(command));
                                                           };
        }
        public dynamic CreateAccount(AddUserAccountCommand command)
        {
            var accountKey = accountKeyGenerator.CreateKey();
            var passwordSalt = securityDigest.CreateSalt();
            var encPassword = securityDigest.EncryptPhase(command.Password, passwordSalt);
            var email = command.Email;
            var rateOutOf = command.RateOutOf;

            var db = Database.Open();
            db.UserAccounts.Insert(Id : Guid.NewGuid(),
                                                    Email: email,
                                                    Password: encPassword,
                                                    PasswordSalt: passwordSalt,
                                                    Key: accountKey,
                                                    RateOutOf: (int)rateOutOf);

            return GetUserAccountByKey(new GetUserAccountByKeyQuery(new AccountContext(accountKey)));
        }