public OpcStatusCollection DeleteHistory(
            OpcContext context,
            OpcHistoryModificationInfo modificationInfo,
            IEnumerable <DateTime> times)
        {
            var results = OpcStatusCollection.Create(OpcStatusCode.Good, times.Count());

            lock (this.syncRoot) {
                int index = 0;

                foreach (var time in times)
                {
                    var result = results[index++];

                    if (this.History.Contains(time))
                    {
                        var value = this.History[time];
                        this.History.RemoveAt(time);

                        var modifiedValue = value.CreateModified(modificationInfo);
                        this.ModifiedHistory.Add(modifiedValue);
                    }
                    else
                    {
                        result.Update(OpcStatusCode.BadNoEntryExists);
                    }
                }
            }

            return(results);
        }
        public OpcStatusCollection UpdateHistory(
            OpcContext context,
            OpcHistoryModificationInfo modificationInfo,
            OpcValueCollection values)
        {
            var results = OpcStatusCollection.Create(OpcStatusCode.Good, values.Count);

            lock (this.syncRoot) {
                var expectedDataTypeId = this.Node.DataTypeId;

                for (int index = 0; index < values.Count; index++)
                {
                    var result = results[index];
                    var value  = OpcHistoryValue.Create(values[index]);

                    if (value.DataTypeId == expectedDataTypeId)
                    {
                        if (this.History.Contains(value.Timestamp))
                        {
                            var oldValue = this.History[value.Timestamp];
                            this.History.Replace(value);

                            var modifiedValue = oldValue.CreateModified(modificationInfo);
                            this.ModifiedHistory.Add(modifiedValue);

                            result.Update(OpcStatusCode.GoodEntryReplaced);
                        }
                        else
                        {
                            this.History.Add(value);

                            var modifiedValue = value.CreateModified(modificationInfo);
                            this.ModifiedHistory.Add(modifiedValue);

                            result.Update(OpcStatusCode.GoodEntryInserted);
                        }
                    }
                    else
                    {
                        result.Update(OpcStatusCode.BadTypeMismatch);
                    }
                }
            }

            return(results);
        }