public void SaveDisplayStatistics(BatchStatistics batchStatistics, int captureBatchId, CaptureState captureState, BatchType batchType, bool saveData)
 {
     // Save the statistics to the database for display on the Analysis tab (save to DisplayStatistics table)
     // Replace cumulative data with new data
     DisplayStatisticsData dsd = new DisplayStatisticsData();
     switch (captureState)
     {
         case CaptureState.Marked:
             switch (batchType)
             {
                 case BatchType.Single:
                     //dsd.DeleteSingleMarkedDisplayStatitics();
                     dsd.InsertSingleMarkedDisplayStatitics(batchStatistics);
                     dsd.UpdateDisplayStatsSavedFlag(captureBatchId, BatchType.Single, true);
                     break;
                 case BatchType.Cumulative:
                     dsd.DeleteCumulativeMarkedDisplayStatitics();
                     dsd.InsertCumulativeMarkedDisplayStatitics(batchStatistics);
                     dsd.UpdateDisplayStatsSavedFlag(captureBatchId, BatchType.Cumulative, true);
                     break;
             }
             break;
         case CaptureState.Unmarked:
             switch (batchType)
             {
                 case BatchType.Single:
                     //dsd.DeleteSingleUnmarkedDisplayStatitics();
                     dsd.InsertSingleUnarkedDisplayStatitics(batchStatistics);
                     dsd.UpdateDisplayStatsSavedFlag(captureBatchId, BatchType.Single, true);
                     break;
                 case BatchType.Cumulative:
                     dsd.DeleteCumulativeUnmarkedDisplayStatitics();
                     dsd.InsertCumulativeUnarkedDisplayStatitics(batchStatistics);
                     dsd.UpdateDisplayStatsSavedFlag(captureBatchId, BatchType.Cumulative, true);
                     break;
             }
             break;
     }
 }