public void DeleteOrDeprecateConsumerGroup(string id) { if (string.IsNullOrWhiteSpace(id)) { throw new MissingParameterException(Common.Constants.Messages.Request.MissingParameter, new List <string>() { nameof(id) }); } var consumerGroupResult = GetEntity(id); var consumerGroupReference = _repository.CheckConsumerGroupHasColidEntryReference(id); if (!consumerGroupReference) { _repository.DeleteEntity(id); _remoteAppDataService.DeleteConsumerGroup(new Uri(id)); _auditTrailLogService.AuditTrail($"Consumer Group with id {id} deleted."); _cacheService.DeleteRelatedCacheEntries <ConsumerGroupService, ConsumerGroup>(); return; } if (CheckConsumerGroupHasStatus(consumerGroupResult, Graph.Metadata.Constants.ConsumerGroup.LifecycleStatus.Deprecated)) { throw new BusinessException(Common.Constants.Messages.ConsumerGroup.DeleteUnsuccessfulAlreadyDeprecated); } consumerGroupResult.Properties.AddOrUpdate(Graph.Metadata.Constants.ConsumerGroup.HasLifecycleStatus, new List <dynamic> { Graph.Metadata.Constants.ConsumerGroup.LifecycleStatus.Deprecated }); var consumerGroup = _mapper.Map <ConsumerGroup>(consumerGroupResult); var metadataProperties = _metadataService.GetMetadataForEntityType(Type); _repository.UpdateEntity(consumerGroup, metadataProperties); _cacheService.DeleteRelatedCacheEntries <ConsumerGroupService, ConsumerGroup>(); _auditTrailLogService.AuditTrail($"Consumer Group with id {id} set as deprecated."); }