/// <summary>
        /// Creates the Audit Event.
        /// </summary>
        public EntityFrameworkEvent CreateAuditEvent(IAuditDbContext context)
        {
            var dbContext       = context.DbContext;
            var modifiedEntries = GetModifiedEntries(context);

            if (modifiedEntries.Count == 0)
            {
                return(null);
            }
            var dbConnection       = IsRelational(dbContext) ? dbContext.Database.GetDbConnection() : null;
            var clientConnectionId = GetClientConnectionId(dbConnection);
            var efEvent            = new EntityFrameworkEvent()
            {
                Entries       = new List <EventEntry>(),
                Database      = dbConnection?.Database,
                ConnectionId  = clientConnectionId,
                TransactionId = GetCurrentTransactionId(dbContext, clientConnectionId)
            };

            foreach (var entry in modifiedEntries)
            {
                var entity            = entry.Entity;
                var validationResults = DbContextHelper.GetValidationResults(entity);
                var entityType        = dbContext.Model.FindEntityType(entry.Entity.GetType());
                efEvent.Entries.Add(new EventEntry()
                {
                    Valid             = validationResults == null,
                    ValidationResults = validationResults?.Select(x => x.ErrorMessage).ToList(),
                    Entity            = context.IncludeEntityObjects ? entity : null,
                    Action            = DbContextHelper.GetStateName(entry.State),
                    Changes           = entry.State == EntityState.Modified ? GetChanges(dbContext, entry) : null,
                    ColumnValues      = GetColumnValues(dbContext, entry),
                    PrimaryKey        = GetPrimaryKey(entityType, entity),
                    Table             = GetEntityName(entityType)
                });
            }
            return(efEvent);
        }