public async Task <IActionResult> Patch(string id, [FromBody] JsonPatchDocument <AgentGroup> request) { try { Guid entityId = new Guid(id); var existingAgentGroup = _agentGroupRepository.GetOne(entityId); if (existingAgentGroup == null) { throw new EntityDoesNotExistException("No agent group exists with the specified id"); } _agentGroupsManager.AttemptPatchUpdate(request, entityId); var result = await base.PatchEntity(id, request); await _webhookPublisher.PublishAsync("AgentGroups.AgentGroupUpdated", existingAgentGroup.Id.ToString(), existingAgentGroup.Name).ConfigureAwait(false); return(result); } catch (Exception ex) { return(ex.GetActionResult()); } }