private void DeleteRelationships(IEnumerable <CustomisationImportRequest> requests) { var response = new CustomisationImportResponse(); var deleted = new List <string>(); foreach (var request in requests) { foreach ( var metadata in CustomisationImportService.ExtractRelationshipMetadataFromExcel(request.ExcelFile.FileName, Controller, response).Values) { if (XrmRecordService.RecordTypeExists(metadata.RecordType1)) { if (!deleted.Contains(metadata.SchemaName) && XrmRecordService.GetManyToManyRelationships(metadata.RecordType1) .Any(r => r.SchemaName == metadata.SchemaName)) { XrmRecordService.DeleteRelationship(metadata.SchemaName); deleted.Add(metadata.SchemaName); } //Assert.IsFalse( // XrmRecordService.GetManyToManyRelationships(metadata.RecordType1) // .Any(r => r.SchemaName == metadata.SchemaName)); } } } }