public static ObservableCollection <Products> GetAllProducts() { List <Products> list; ObservableCollection <Products> list2; using (var db = new SQLiteConnection(new SQLitePlatformGeneric(), "sale.db")) { list = db.GetAllWithChildren <Products>(recursive: true).ToList().Where(x => x.ProductStatus == 1) .OrderBy(x => x.Producer.ProducerName).ToList(); } list2 = new ObservableCollection <Products>(list); return(list2); }