public async Task Append(IStoredEvent[] @events)
        {
            await Task.Run(() =>
            {
                var handler = BeforeSave;
                if (handler != null)
                {
                    @events.ForEach(e => handler(this, e));
                }

                lock (this.events)
                {
                    foreach (var storedEvent in events)
                    {
                        if (this.events.Contains(storedEvent))
                        {
                            throw new ConcurrencyException(string.Format("There was a concurrency violation.\n  Existing:\n{0}\nAttempted:\n{1}",
                                this.events.Single(e => e.AggregateId == storedEvent.AggregateId &&
                                                        e.SequenceNumber == storedEvent.SequenceNumber)
                                    .ToDomainEvent(Name)
                                    .ToDiagnosticJson(),
                                storedEvent.ToDiagnosticJson()));
                        }
                        this.events.Add(storedEvent);
                    }
                }
            });
        }
        public async Task Append(IStoredEvent[] @events)
        {
            await Task.Run(() =>
            {
                var handler = BeforeSave;
                if (handler != null)
                {
                    @events.ForEach(e => handler(this, e));
                }

                lock (this.events)
                {
                    foreach (var storedEvent in events)
                    {
                        if (this.events.Contains(storedEvent))
                        {
                            ThrowConcurrencyException(storedEvent);
                        }
                        this.events.Add(storedEvent);
                    }
                }
            });
        }