public static bool Save(Performance performance)
        {
            DbContextTransaction transaction = null;

            try
            {
                using (var _db = new MonitoringContext())
                {
                    using (transaction = _db.Database.BeginTransaction())
                    {
                        _db.Performances.Add(performance);
                        //_db.Database.ExecuteSqlCommand(@"SET IDENTITY_INSERT [dbo].[Performance] ON");
                        _db.SaveChanges();
                        // _db.Database.ExecuteSqlCommand(@"SET IDENTITY_INSERT [dbo].[Performance] OFF");
                        transaction.Commit();

                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog(ex);
                AuditLogRepository.Save(ex);
            }


            return(false);
        }
        public static bool Save(Exception exception)
        {
            DbContextTransaction transaction = null;

            try
            {
                using (var _db = new MonitoringContext())
                {
                    using (transaction = _db.Database.BeginTransaction())
                    {
                        //this should be in the AuditLog class, but as this project is going EF database first, that class is generated
                        var auditLog = new AuditLog
                        {
                            Exception      = exception.Message,
                            InnerException = exception.InnerException?.InnerException?.Message,
                            Source         = exception.Source,
                            StackTrace     = exception.StackTrace,
                            TargetSite     = exception.TargetSite.Name,
                            ExceptionDate  = DateTime.Now
                        };

                        _db.AuditLogs.Add(auditLog);
                        //_db.Database.ExecuteSqlCommand(@"SET IDENTITY_INSERT [dbo].[AuditLog] ON");
                        _db.SaveChanges();
                        // _db.Database.ExecuteSqlCommand(@"SET IDENTITY_INSERT [dbo].[AuditLog] OFF");
                        transaction.Commit();

                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog(ex);
            }

            return(false);
        }