How do I delete root records of shares?

When I try to delete records in CloudKit Dashboard by querying them and then selecting them and clicking on the trash can icon at the top right-hand side of the query results, I get a message box saying that those records will be deleted in a box shaded red, but the delete button at the bottom right-hand side of the box is grayed out and doesn't respond when I click it.

These records were root records of shares whose shares in the cloudkit.share table I have deleted using CKModifyRecordsOperation.

For some reason when I deleted the shares, the root records were not deleted. Then when I try to delete those root records using CKModifyRecordsOperation, I got an error.

Here is my code in CKModifyRecordsOperation.modifyRecordsCompletionBlock that caught the error:

if let error = error {

    print("error:")

    print(error.localizedDescription)

    if let ckError = self.handleCloudKitError(error, operation: .modifyRecords) {

        if let serverVersion = ckError.serverRecord {

            serverRecord = serverVersion

            print("serverRecord:")

            print(serverRecord!)

        }

    }

}

Here is what my code above printed in the Debug window:

error: Internal server error ModifyRecords operation error: <CKError 0x600001bb9920: "Server Rejected Request" (15/2000); server message = "Internal server error"; op = 49A32A559E4F4C11; uuid = 22F46530-5F45-463E-A21F-279C3876C897; container ID = "iCloud.us.gnolaum.Courier">

How do I delete root records of shares?
 
 
Q