public ActionResult Register(string username, string email, string password)
        {
            var user = _usersProvider.GetByEmail(email);

            if (user != null)
            {
                throw new Exception("User with that email already exists.");
            }

            user = new User
            {
                Username   = username,
                Email      = email,
                Password   = password,
                DateJoined = DateTime.Now
            };
            try
            {
                _usersProvider.Insert(user);
                _usersProvider.Save();
            }
            catch (Exception exception)
            {
                //decide if additional format should be returned
                throw;
            }

            var token = IdentitySignin(new UserDto(user));

            return(Json(new { accessToken = token, userName = username }));
        }