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