Building a table in Write using BASIC

I want to write script that finds a table in the Writer doc, deletes it, and recreates it. I can find it like this:

oDoc = StarDesktop.loadComponentFromURL(ConvertToUrl("some path and file name"), "default", 0, args())
oAllTables = oDoc.TextTables
oMyTable = oAllTables.getByName("table7")

How do I delete it and create a new one with the same name in the same location?

I’m using LibreOffice 24.2.6.2 (X86_64) on Ubuntu 22.04.5 LTS

 ovc = ThisComponent.Currentcontroller.getviewcursor
 ovc.gotorange(oMyTable.getanchor.getstart, false)

oMyTable.dispose

oNewTable = ThisComponent.createInstance("com.sun.star.text.TextTable")
oNewTable.initialize(2, 3)
Thiscomponent.Text.insertTextContent( ovc, oNewTable, False)

oNewTable.name = "table7"

For ref.