// PUT api/Users/5
        public IHttpActionResult PutUser(int id, User user)
        {
            user.Role = null;
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != user.UserID)
            {
                return(BadRequest());
            }

            try
            {
                Model.User _user = _userService.GetUser(id);
                if (user.UserPassword != _user.UserPassword)
                {
                    Helpers.SecurityHelper _securityHelper = new Helpers.SecurityHelper();
                    user.UserPassword = _securityHelper.Md5Encryption(user.UserPassword);
                }
                _userService.UpdateUser(user);
                _userService.SaveUser();
            }
            catch (Exception ex)
            {
                if (!UserExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }