public static IEnumerable <EntityType> Entities <EntityType>(this IDataModel model) where EntityType : Entity { return(model.Entites().Select(x => x as EntityType).Where(x => x != null)); }