Moved create/update-logic into transaction + sorted Tags.