public static TEntity FindEntity <TEntity>(Expression <Func <TEntity, bool> > predicate) where TEntity : class, new() { using (DistributionContext dbcontext = new DistributionContext()) { return(dbcontext.Set <TEntity>().FirstOrDefault(predicate)); } }