/// <inheritdoc />
        public virtual int Count(Expression <Func <TEntity, bool> > filter = null)
        {
            int count = DecoratedService.Count(filter);

            try
            {
                var options = new AuditScopeOptions
                {
                    EventType   = $"{EntityName}:Count",
                    ExtraFields = new { Count = count },
                    AuditEvent  = new AuditEvent {
                        Target = new AuditTarget()
                    }
                };

                using (var auditScope = AuditScope.Create(options))
                {
                    auditScope.Event.Environment.UserName = UserContext.CurrentUser;
                    auditScope.Event.Target.Type          = $"{EntityFullName}";
                }
            }
            catch (Exception e)
            {
                Logger.Warning(e, "Auditing failed for Count of type {Entity}.", EntityName);
            }

            return(count);
        }