moving section in writer document using macro

Is it possible, via macro, to move (not copy) a pre-existing section, therefore already created and inserted in the writer document?
I thought this code was enough

oD= ThisComponent
refSection = oD.TextSections.getByName ( "sec1")
oV = oD.currentController.virtualCursor
oD.Text.insertTextContent (oV, refSection, False)

this code works well both to move textframes to the current position of the virtualCursor and to insert newly created sections
On the contrary, with pre-existing section this code keep giving me error Type: “com.sun.star.uno.RuntimeException Message:.”
In the absence of the message I do not understand the error
Thanks in advance for any suggestions

Strangely, I also have problems with the section copy & paste, which previously worked, but I’m still testing it.

LO: Version: 6.2.8.2
SO; Ubuntu16.04.1

It was not the answer I was looking for. It seems strange to me that, once inserted, it is not possible with a macro to move a textcontent object (the section object should be a textcontent) within the text unless you use the cut & paste

In the example below, for simplicity the document contains only one section which is moved within the document itself to the current position of the view cursor (mouse position)

Attention:

  1. one: Paste and one: Cut and in general the commands uno: xxxx are casesensitive

  2. the section must be selected by selecting also a character before and after the section proper. Otherwise only the content of the section is moved, not the section as a whole

This is the code.

                          '  cut section with index 0 in current document   
                          '  and copy in current position of view cursor
 sub sezText01()
       sezCopyPaste(thisComponent.textSections.getByIndex(0))
 end sub
    
Sub sezCopyPaste(oSec,optional cursPos, optional oD)   
   Dim oVC, oSezTC, oText
   Dim oDisp, oC, oF
   
   if isMissing(oD) then oD=thisComponent
   
   oDisp  =createUnoService("com.sun.star.frame.DispatchHelper") 
   oC = oD.currentController:  oF= oC.frame
   oText = oD.getText()
   oVC=oC.getViewCursor
   
   if isMissing(cursPos) then 
                                             ' textcursor cursPos on current viewCursor
      cursPos = oVC.getText.createTextCursorByRange(oVC) 
   end if
                                            ' create curson around oSec for selecting
   oSezTC= oText.createTextCursorByRange(oSec.Anchor.getStart()) 
   oSezTC.goLeft(1, false) 
   oSezTC.gotoRange(oSec.Anchor.End,true)
   oSezTC.goright(1,true)
   oC.select(oSezTC)
     
   oDisp.executeDispatch(oF, ".uno:Cut", "", 0, Array())    
   oVc.gotoRange(cursPos.start,false)
   oDisp.executeDispatch(oF, ".uno:Paste", "", 0, Array())

end sub