internal Func <AuditEvent, EventEntry, object, bool> GetAction()
 {
     return((ev, ent, auditEntity) =>
     {
         MappingInfo map = null;
         bool include = true;
         var entityType = ent.EntityType;
         if (entityType != null && _mapping.TryGetValue(entityType, out map))
         {
             if (map.Action != null)
             {
                 include = map.Action.Invoke(ev, ent, auditEntity);
             }
         }
         if (include && _commonAction != null)
         {
             include = _commonAction.Invoke(ev, ent, auditEntity);
         }
         return include;
     });
 }
        // Returns a generic action that executes the specific action for the mapping and the common action
        internal Func <AuditEvent, EventEntry, object, Task <bool> > GetAction()
        {
            return(async(ev, ent, auditEntity) =>
            {
                MappingInfo map = null;
                bool include = true;
                bool mappedExplicitly = false;
                if (_explicitMapping != null)
                {
                    foreach (var em in _explicitMapping)
                    {
                        if (em.Key.Invoke(ent))
                        {
                            map = em.Value;
                            include = await map.Action.Invoke(ev, ent, auditEntity);

                            mappedExplicitly = true;
                            break;
                        }
                    }
                }
                if (!mappedExplicitly)
                {
                    var entityType = ent.EntityType;
                    if (entityType != null && _mapping.TryGetValue(entityType, out map))
                    {
                        if (map.Action != null)
                        {
                            include = await map.Action.Invoke(ev, ent, auditEntity);
                        }
                    }
                }

                if (include && _commonAction != null)
                {
                    include = await _commonAction.Invoke(ev, ent, auditEntity);
                }
                return include;
            });
        }