private void TryUpdateUser(UserViewModel model) { var userId = model.User_ID; var original = _userService.GetByID(userId); _userService.Detach(original); var user = model.ToEntity(); user.DateCreated = original.DateCreated; user.IsActive = original.IsActive; user.DateLastUpdated = DateTime.Now; if (!string.IsNullOrEmpty(model.Password)) { user.Password = model.Password; } else { user.Password = original.Password; } _userService.Update(user); CacheServer.DeleteFromTable(Consts.Users, "User_" + userId); SuccessMessage(string.Format(MessageText.UserUpdated, user.UserName)); }