Arranging items within groups or tables

Hi,

as you might know, OmniGraffle tables have a bug that makes the position of an item on the z-axis unpredictable. Here is a short gif to show what I mean:


I actually need a consistent order that’s why I tried writing a script that is supposed to move selected table cells to the top of the table group. It doesn’t do anything though. I suppose the reason is that items within a table can’t be arranged. Can anybody give me a hint or propose a different solution? Here is not not-working code:

tell application id "OGfl"
	set allGroups to groups of canvas of front window
	set cntGroups to 0 -- just for debugging
	repeat with currentGroup in allGroups -- go through all groups
		set cntGroups to cntGroups + 1
		
		set cntItems to 0
		set itemsInGroup to graphics of currentGroup
		repeat with currentItem in itemsInGroup -- go through all items
			set cntItems to cntItems + 1
			log "Group " & cntGroups & ", Item " & cntItems
			log currentItem
			
			-- try to move items to the front that have a certain user data key value pair
			try
				set arrange to value of user data item "arrange" of currentItem
				log arrange
				if arrange is equal to "toFront" then
					move currentItem to beginning of graphics of currentGroup
					-- Error: error number -1728 from graphic id 177962 of canvas id 1 of document "test.graffle"

				end if
			end try
			
		end repeat
	end repeat
end tell

Cheers!