```swift do { guard let postWithComments = try await Amplify.DataStore.query(Post.self, byId: "123") else { print("No post found") return } try await Amplify.DataStore.delete(postWithComments) print("Post with id 123 deleted with success") } catch let error as DataStoreError { print("Failed with error \(error)") } catch { print("Unexpected error \(error)") } ``` ```swift let sink = Amplify.Publisher.create { guard let postWithComments = try await Amplify.DataStore.query(Post.self, byId: "123") else { return } try await Amplify.DataStore.delete(postWithComments) }.sink { if case let .failure(error) = $0 { print("Error deleting post and comments - \(error)") } } receiveValue: { print("Post with id 123 deleted with success") } ```