private static void import(SymmetryEntities dc_, AuctionInfo info_)
    {
      var cusipIdentifier = findCusipIdentifier(dc_, info_);

      if (cusipIdentifier == null) return;

      // take the opportunity to update the coupon if it's different

      if (cusipIdentifier.FI != null 
        && cusipIdentifier.FI.FIBond != null 
        && info_.Coupon.HasValue
        && Math.Abs(Convert.ToDouble(cusipIdentifier.FI.FIBond.Coupon) - info_.Coupon.Value) > 1e-3)
      {
        SLog.log.InfoFormat("Changing coupon of {0} from {1} to {2}", cusipIdentifier.Identifier,
          cusipIdentifier.FI.FIBond.Coupon, info_.Coupon);

        cusipIdentifier.FI.FIBond.Coupon = Convert.ToDecimal(info_.Coupon.Value);
        FIChangeTracking.SetModified(cusipIdentifier.FI.FIBond, dc_);
        dc_.SaveChanges();
      }


      bool found = false;

      foreach (var auction in dc_.FIBondAuctions.Where(x => x.FIID == cusipIdentifier.FIID))
      {

        if (auction.AuctionDate == info_.AuctionDate.Value)
        {
          //SLog.log.DebugFormat("Auction already set up for {0} on {1}", info_.Cusip, info_.AuctionDate.Value);

          if (!auction.EffectiveDate.HasValue)
          {
            SLog.log.InfoFormat("Updating auction effective date to {0}", info_.IssueDate.Value);
            auction.EffectiveDate = info_.IssueDate.Value;
            FIChangeTracking.SetModified(auction, dc_);
          }
          found = true;
          break;
        }
      }

      if (found)
      {
        dc_.SaveChanges();
        return;
      }

      SLog.log.InfoFormat("Setting up auction for {0} on {1}", info_.Cusip, info_.AuctionDate.Value);


      var newAuction = new FIBondAuction()
      {
        FIID = cusipIdentifier.FIID,
        FIBond = dc_.FIBonds.FirstOrDefault(x => x.FIID == cusipIdentifier.FIID),
        AuctionDate = info_.AuctionDate.Value,
        EffectiveDate = info_.IssueDate.Value,
        Term = info_.Term.Value
      };

      dc_.FIBondAuctions.Add(newAuction);
      dc_.SaveChanges();
    }
    public static void Go(bool makeChanges_=false)
    {
      string path = @"e:\TreasuryOTRHistory.csv";
      var missingBonds = new List<MissingBond>();

      using (var dc = SymmetryDataSource.ReadWrite())
      {
        var earliestMaturity = new DateTime(2008, 1, 1);

        foreach (var l in CsvFile.Read<Line>(path).Where(x=>x.MaturityAsDate>=earliestMaturity))
        {
          var cusipIdentifier =
            dc.FIIdentifiers.FirstOrDefault(
              x => String.Compare(l.CUSIP, x.Identifier, StringComparison.OrdinalIgnoreCase) == 0);

          if (cusipIdentifier == null)
          {
            // can we find by assuming that the cusip is contained with the ISIN...

            var fi = dc.FIs.FirstOrDefault(x => x.InstrumentType == Symmetry.Data.Enums.InstrumentType.Bond
                                                && x.SymmetryCode.Contains(l.CUSIP));

            if (fi == null)
            {
              Logger.Error(string.Format("Couldn't find a bond for cusip={0}, Term={1}", l.CUSIP,l.Term),
                typeof(ProcessUSTreasuryAuctionsFile));
              missingBonds.Add(new MissingBond {CUSIP = l.CUSIP, Maturity=l.MaturityString});
              continue;
            }

            if (!makeChanges_) continue;

            // we need to create a cusip identifier too
            cusipIdentifier = new FIIdentifier()
            {
              FIID = fi.FIID,
              FI = fi,
              Identifier = l.CUSIP,
              IdentifierType = Symmetry.Data.Enums.IdentifierType.CUSIP
            };

            Logger.Info(string.Format("Adding in cusip identifer for bond={0} (cusip={1})", fi.SymmetryCode, l.CUSIP),
              typeof (ProcessUSTreasuryAuctionsFile));

            dc.FIIdentifiers.Add(cusipIdentifier);

          }

          if (!makeChanges_)
            continue;

          bool found = false;

          foreach (var auction in dc.FIBondAuctions.Where(x => x.FIID == cusipIdentifier.FIID))
          {
            if (auction.AuctionDate == l.AuctionDateAsDate)
            {
              Logger.Info(string.Format("Auction already set up for {0} on {1}", l.CUSIP, l.AuctionDateAsDate),
                typeof (ProcessUSTreasuryAuctionsFile));

              if (!auction.EffectiveDate.HasValue)
              {
                Logger.Info(string.Format("Updating effectivedate"), typeof (ProcessUSTreasuryAuctionsFile));
                auction.EffectiveDate = l.IssueDateAsDate;
                FIChangeTracking.SetModified(auction, dc);
              }
              found = true;
              break;
            }
          }

          if (found) 
            continue;

          Logger.Info(string.Format("Setting up auction for {0} on {1}", l.CUSIP, l.AuctionDateAsDate),
            typeof (ProcessUSTreasuryAuctionsFile));

          var newauction = new FIBondAuction()
          {
            FIID = cusipIdentifier.FIID,
            FIBond = dc.FIBonds.FirstOrDefault(x => x.FIID == cusipIdentifier.FIID),
            AuctionDate = l.AuctionDateAsDate,
            EffectiveDate=l.IssueDateAsDate,
            Term = Convert.ToInt32(Math.Round((l.MaturityAsDate - l.AuctionDateAsDate).TotalDays/365.2, 0))
          };

          dc.FIBondAuctions.Add(newauction);
        }

        if(makeChanges_) dc.SaveChanges();

       
      }

      if (missingBonds.Count > 0)
        missingBonds.ToCsv(@"e:\missingUSBonds.csv");
    }