private static void GenerateMatlabFile(IList <AnnotationRecord> records, string filePath)
        {
            using (AnnotationRecordOperator annotationRecordOperator
                       = new AnnotationRecordOperator(filePath, AnnotationRecordOperator.DesiredAccess.Write, AnnotationRecordOperator.CreationDisposition.CreateAlways))
            {
                int count = records.Count;
                annotationRecordOperator.Resize(Convert.ToUInt64(count));

                for (int index = 0; index < count; ++index)
                {
                    var record = records[index];

                    annotationRecordOperator.Set(Convert.ToUInt64(index), record);
                }
            }
        }
        public void UpdateMatlabFile()
        {
            if (_pendingUpdates.Count == 0)
            {
                return;
            }

            using (AnnotationRecordOperator annotationRecordOperator =
                       new AnnotationRecordOperator(GetMatFilePath(), AnnotationRecordOperator.DesiredAccess.Write,
                                                    AnnotationRecordOperator.CreationDisposition.OpenAlways))
            {
                foreach (var index in _pendingUpdates)
                {
                    var record = _annotationRecords[index];

                    annotationRecordOperator.Set(Convert.ToUInt32(index), record);
                }
            }

            _pendingUpdates.Clear();
        }