public async Task UpdateRelationshipDatasetDefinitionName(Reference datsetDefinitionReference) { if (datsetDefinitionReference == null) { _logger.Error("Null dataset definition reference supplied"); throw new NonRetriableException("A null dataset definition reference was supplied"); } IEnumerable <DefinitionSpecificationRelationship> relationships = (await _datasetRepository.GetDefinitionSpecificationRelationshipsByQuery(m => m.DatasetDefinition.Id == datsetDefinitionReference.Id)).ToList(); if (!relationships.IsNullOrEmpty()) { int relationshipCount = relationships.Count(); _logger.Information($"Updating {relationshipCount} relationships with new definition name: {datsetDefinitionReference.Name}"); try { foreach (DefinitionSpecificationRelationship definitionSpecificationRelationship in relationships) { definitionSpecificationRelationship.DatasetDefinition.Name = datsetDefinitionReference.Name; } await _datasetRepository.UpdateDefinitionSpecificationRelationships(relationships); _logger.Information($"Updated {relationshipCount} relationships with new definition name: {datsetDefinitionReference.Name}"); } catch (Exception ex) { _logger.Error(ex, ex.Message); throw new RetriableException($"Failed to update relationships with new definition name: {datsetDefinitionReference.Name}", ex); } } else { _logger.Information($"No relationships found to update"); } }