//Update a WebHook for a User. Also need to serialize into JSON and decrypt data using ASP.NET Core Protect. public override async Task <StoreResult> UpdateWebHookAsync(string user, WebHook webHook) { if (user == null) { throw new ArgumentNullException(nameof(user)); } if (webHook == null) { throw new ArgumentNullException(nameof(webHook)); } user = NormalizeKey(user); try { var registration = await _webHookRepository.GetOne <Registration>(webHook.Id, user); if (registration == null) { return(StoreResult.NotFound); } Registration registrationToUpdate = ConvertToUpdateRegistrationFromWebHook(user, webHook, registration); return(await _webHookRepository.UpdateOne(registrationToUpdate, webHook.Id, user)); } catch (OptimisticConcurrencyException ocex) { var message = string.Format(CultureInfo.CurrentCulture, Constants.Constants.ConcurrencyError, "Update", ocex.Message); _logger.Error(message, ocex); return(StoreResult.Conflict); } catch (DbException dbex) { var message = string.Format(CultureInfo.CurrentCulture, Constants.Constants.MongoOperationFailed, "Update", dbex.Message); _logger.Error(message, dbex); return(StoreResult.OperationError); } catch (Exception ex) { var message = string.Format(CultureInfo.CurrentCulture, Constants.Constants.OperationFailed, "Update", ex.Message); _logger.Error(message, ex); return(StoreResult.InternalError); } }