 
                 if let feed = conversation.withGroup?.withFeed {
 
-                    for attachment in feed.attachments {
-                        realm.delete(attachment)
-                    }
-
-                    realm.delete(feed)
+                    feed.cascadeDelete()
                 }
 
                 let groupID = group.groupID

            return
        }

        if let feed = withFeed {

            feed.attachments.forEach {
                realm.delete($0)
            }

            realm.delete(feed)
        }

        if let conversation = conversation {
            realm.delete(conversation)

    dynamic var skill: UserSkill?

    dynamic var group: Group?

    // 级联删除关联的数据对象

    func cascadeDelete() {

        guard let realm = realm else {
            return
        }

        attachments.forEach {
            realm.delete($0)
        }

        realm.delete(self)
    }
}


