diff --git a/uSync8.ContentEdition/Serializers/ContentSerializer.cs b/uSync8.ContentEdition/Serializers/ContentSerializer.cs index 4b793155..f3deee37 100644 --- a/uSync8.ContentEdition/Serializers/ContentSerializer.cs +++ b/uSync8.ContentEdition/Serializers/ContentSerializer.cs @@ -333,9 +333,11 @@ protected override uSyncChange HandleTrashedState(IContent item, bool trashed) else if (trashed && !item.Trashed) { // move to the recycle bin - logger.Debug("Moving content into Recycle bin {id}", item.Id); + // clean any relations that may be there (stops an error) + CleanRelations(item, "relateParentDocumentOnDelete"); + contentService.MoveToRecycleBin(item); return uSyncChange.Update("Moved to Bin", item.Name, "", "Recycle Bin"); } diff --git a/uSync8.ContentEdition/Serializers/MediaSerializer.cs b/uSync8.ContentEdition/Serializers/MediaSerializer.cs index 76729648..942fb948 100644 --- a/uSync8.ContentEdition/Serializers/MediaSerializer.cs +++ b/uSync8.ContentEdition/Serializers/MediaSerializer.cs @@ -110,6 +110,10 @@ protected override uSyncChange HandleTrashedState(IMedia item, bool trashed) } else if (trashed && !item.Trashed) { + + // clean any rouge relations + CleanRelations(item, "relateParentMediaFolderOnDelete"); + // move to the recycle bin mediaService.MoveToRecycleBin(item); return uSyncChange.Update("Moved to Bin", item.Name, "", "Recycle Bin");