I think the problem is with 'Delete cta'...Leeluna is looping through each Datacatalogue record within the cta entity but then deleteing cta (meaning everything) rather then the DataCatalogue record in question... fix would be Delete cta\datacatalogue
No... "cta" is the current instance of the type list DataCatalogue. It probably doesn't have a "\datacatalogue" field. He is deleting only the current instance, not the whole list.
I can't see anything wrong with that function either.
Is there any chance the Save function has a problem?