title: Many-to-many relationships in DDD
body: <p>I'm new to DDD and I'm stuck with many-to-many relationships. E.g. we have two aggregate roots - Tasks and Workers.</p>
  
  <p>Contract is definitely not aggregate root, because it has no sense without Task and Worker. So, it should be part of some aggregate. But which aggregate should it belong to? We need to know both summary costs of all task contracts and summary costs of all worker contracts. And it's natural for me to have contracts collection both in Task and in Worker. </p>
  
  <p>Well, I can move Costs calculation to domain service, but I afraid it's a step forward to anemic model. Is there common way to deal with many-to-many relationships and preserve reach domain model?</p>
  
  <p>Thanks!</p>
  
  <p><img src="https://i.stack.imgur.com/vtZuZ.png" alt="Class diagram"></p>