Creating transactions and relationships between classes