public static EmployeeTerritory SingleOrDefault(Expression<Func<EmployeeTerritory, bool>> expression) { var repo = GetRepo(); var results=repo.Find(expression); EmployeeTerritory single=null; if(results.Count() > 0){ single=results.ToList()[0]; single.OnLoaded(); single.SetIsLoaded(true); single.SetIsNew(false); } return single; }