public HttpResponseMessage RegisterUser(UserModel model)
        {
            return this.ExecuteOperationAndHandleExceptions(() =>
            {
                this.ValidateUser(model);

                var data = new UserRepository(
                ConfigurationManager.AppSettings["MongoConnectionString"],
                ConfigurationManager.AppSettings["Database"]);

                var dbUser = data.All().FirstOrDefault(u => u.Username.ToLower() == model.Username.ToLower());
                if (dbUser != null)
                {
                    throw new InvalidOperationException("This user already exists in the database");
                }

                dbUser = new DbUserModel()
                {
                    Username = model.Username,
                    AuthCode = model.AuthCode
                };

                data.Add(dbUser);

                var responseModel = new RegisterUserResponseModel()
                {
                    Id = dbUser.Id,
                    Username = dbUser.Username,
                };

                var response = this.Request.CreateResponse(HttpStatusCode.Created, responseModel);
                return response;
            });
        }