Added 'with transaction' blocks to get_or_create statements to avoid duplicates