protected override void MarkModified()
        {
            if (!this.IsTransient())
            {
                Validator.ThrowWhenTrue(() => IsRemoved(), "Entity cannot be modified, it was set as Deleted Entity");

                base.MarkModified();
                if (ReadModel.DomainEvents == null || !ReadModel.DomainEvents.Any(o => o is OnEntityUpdated <TAggregateRoot>))
                {
                    ReadModel.AddDomainEvent(new OnEntityUpdated <TAggregateRoot>(GetEntity()));
                }
            }
        }
        protected override void MarkRemoved()
        {
            if (!this.IsTransient())
            {
                base.MarkRemoved();

                if (ReadModel.DomainEvents == null || !ReadModel.DomainEvents.Any(o => o is OnEntityDeleted <TAggregateRoot>))
                {
                    ReadModel.AddDomainEvent(new OnEntityDeleted <TAggregateRoot>(GetEntity()));
                }

                // clear updated events
                if (ReadModel.DomainEvents.Any(o => o is OnEntityUpdated <TAggregateRoot>))
                {
                    ReadModel.DomainEvents.Where(o => o is OnEntityUpdated <TAggregateRoot>)
                    .ToList()
                    .ForEach(o => ReadModel.RemoveDomainEvent(o));
                }
            }
        }