private void FillPhaseGaps(Deal deal)
 {
     for (int i = 1; i <= (int)DealPhase.Valmis; i++)
     {
         if (!dealVersions[deal.DbId].ContainsKey((DealPhase)i))
         {
             DealPhaseTransition dpt = new DealPhaseTransition(
                 deal.DbId, deal.DbId, deal.Name, null, null, (DealPhase)i);
             transitions.Add(dpt);
             dealVersions[deal.DbId].Add((DealPhase)i, deal);
         }
     }
 }
 private void StorePhaseTransition(Deal deal, Deal currentDeal, DateTime?dateOut)
 {
     if (!dealVersions.ContainsKey(currentDeal.DbId) ||
         !dealVersions[currentDeal.DbId].ContainsKey(deal.Phase))
     {
         DealPhaseTransition dpt = new DealPhaseTransition(
             deal.DbId, currentDeal.DbId, currentDeal.Name, deal.CreationTime, dateOut, deal.Phase);
         transitions.Add(dpt);
         if (!dealVersions.ContainsKey(currentDeal.DbId))
         {
             dealVersions.Add(currentDeal.DbId, new Dictionary <DealPhase, Deal>());
         }
         dealVersions[currentDeal.DbId].Add(deal.Phase, deal);
     }
 }