public virtual void ProcessCommand(IEntityGuid entity, CommandTypeOption type) { if (entity == null) { return; } var storeHistoryAttributes = entity.GetType().GetCustomAttributes(typeof(StoreHistoryAttribute), inherit: true); if (!storeHistoryAttributes.HasItems <object>()) { return; } var storeHistoryAttr = (StoreHistoryAttribute)storeHistoryAttributes.First(); string serializedData = null; if (storeHistoryAttr.StoreSnapShot) { serializedData = _serializer.Serialize(entity); } var entityHistory = CreateHistoryRecord(storeHistoryAttr, entity, type, _currentUser, serializedData); ProcessCustomValuesForEntity(entity, entityHistory); _repository.AddOrUpdate(entityHistory); }