protected void Commit(Entity entity, ICommand command, string action, object lastEntity = null)
        {
            if (_notifications.HasNotifications())
            {
                return;
            }
            if (_architectureContext.SaveChanges() > 0)
            {
                var eventEntity = EventEntity.GetEvent(
                    action, entity, command, _authService.UserLoggedIn, lastEntity);

                _eventSourcingContext.EventEntities.Add(eventEntity);
                var teste = JObject.Parse(eventEntity.Data);
                if (JObject.Parse(eventEntity.Data).HasValues)
                {
                    _eventSourcingContext.SaveChanges();
                }
            }
            else
            {
                AddNotification(new DomainNotification("Commit", "We had a problem during saving your data."));
            }
        }
        public void Save(Event @event, object data)
        {
            //var ignoredMembersList = GetAttributs(@event).Select(_=>_.Name);
            var listIgnoredMembers = GetAttributs(@event).Select(_ => _.Name);

            var all = _eventSourcingContext.StoredEvent.Where(x => x.AggregateId == @event.AggregateId).OrderByDescending(x => x.Data).ToArray();

            if (data != null)
            {
                var props = data.GetType().GetProperties().Select(x =>
                                                                  new KeyValuePair <string, object>(x.Name, x.GetValue(data, new object[] { })))
                            .Where(x => !listIgnoredMembers.Contains(x.Key));


                foreach (var prop in props)
                {
                    var getPropSave = @event.GetType().GetProperty(prop.Key)?.GetValue(@event, null);
                    if ((prop.Value == null && getPropSave != null) && LastChangeIsEqual(prop.Key, all))
                    {
                        var propEvent = @event.GetType().GetProperty(prop.Key, BindingFlags.Public | BindingFlags.Instance);
                        propEvent.SetValue(@event, null, null);
                    }

                    if ((prop.Value?.ToString() == getPropSave?.ToString() && (prop.Value != null && getPropSave != null) && prop.Key != "AggregateId" && prop.Key != "Who" && prop.Key != "id"))
                    {
                        var propEvent = @event.GetType().GetProperty(prop.Key, BindingFlags.Public | BindingFlags.Instance);
                        if (null != propEvent && propEvent.CanWrite)
                        {
                            propEvent.SetValue(@event, null, null);
                        }
                    }
                }
            }

            _eventSourcingContext.StoredEvent.Add(new StoredEvent(@event, "name user"));
            _eventSourcingContext.SaveChanges();
        }