public IQueryable <TEntity> Set <TEntity>() where TEntity : class { if (typeof(TEntity) == typeof(RootContent)) { return((IQueryable <TEntity>)Roots.AsQueryable()); } if (typeof(TEntity) == typeof(ChildContent)) { return((IQueryable <TEntity>)Roots .SelectMany(r => r.Children) .ToList() .AsQueryable()); } throw new ArgumentException(); }