public virtual void Insert(T entity) { try { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } _context.Set <T>().Add(entity); _context.SaveChangesAsync(); } catch (DbEntityValidationException dbEx) { throw new Exception(GetValidations(dbEx)); } }