public Task <int> SaveChangesAsync(bool invalidateSecondLevelCache, CancellationToken cancellationToken)
        {
            ChangeTracker.DetectChanges();

            AutoDetectChangesEnabled = false;

            var hookEngine = new HookEngine(this);

            hookEngine.ExecutePreActionHooks();

            var changedEntityNames = ChangeTracker.GetChangedEntityNames();

            var result = base.SaveChangesAsync(cancellationToken);

            hookEngine.ExecutePostActionHooks();

            AutoDetectChangesEnabled = true;

            if (!invalidateSecondLevelCache)
            {
                return(result);
            }

            InvalidateSecondLevelCache(changedEntityNames);

            return(result);
        }