public T Create(T entity) { // validation if (entity == null) { throw new AppException("entity cannot be null."); } _context.Add(entity); _context.SaveChanges(); return(entity); }