How to move an item to multiple folders?

I’m writing a filing script that would ask for a set of folders, separated by “;”, and then create a replicate of the original in each of the groups. The problem is that if I use “replicate record theItem to …” I end up with the originals in the folder they started in and if I use “move record theItem to …” the last move effectively cancels all the previous ones. So I was trying to replicate the items to the groups and the delete the originals, but I’m not able to get the parent of the selected items so that only those replicants would be deleted.

Any ideas?

tell application "DEVONthink Pro"
	
	set theSelection to the selection
	if (count of theSelection) < 1 then error "Please select one or more items."
	
	repeat
		display dialog "Enter folder(s) to use:" default answer "" buttons {"Cancel", "OK"} default button 2
		set theAnswer to the text returned of the result
		if theAnswer is not "" then exit repeat
	end repeat
	
	set tid to AppleScript's text item delimiters
	set AppleScript's text item delimiters to ";"
	set theFolderSet to the text items of theAnswer
	set AppleScript's text item delimiters to tid
	
	set theReferenceFolder to "/+Reference"
	set theItem to the first item of theSelection
	set theParentFolder to parent 1 of record theItem
	
	repeat with theFolder in theFolderSet
		set theFullFolder to create location (theReferenceFolder & "/" & theFolder)
		
		repeat with theItem in theSelection
			replicate record theItem to theFullFolder
		end repeat
		
		repeat with theItem in theSelection
			delete record theItem in theParentFolder
		end repeat
		
	end repeat
	
end tell

You could move the item to the first folder initially and then add replicants to other folders if necessary.

But of course… Thanks!