Question: I'm looking to change notifications settings for a single application remotely.
I've got the device enrolled into a MDM.
Android device running 6.01.

I can remotely deploy / update apps etc...
However, I want to disable notifications for this. I can't seem to find a hands off approach to doing this.

I'd have to break out of the end user lock down application.
Go to settings
apps
find app
notifications
block
restart device.

Is there a way I can remotely make this change?

Thanks in advance.

Answer: 
I don't know since which version of EFCore it's possible, but there's a simpler single-query alternative now:

```
context.Topic
   .SelectMany(topic => topic.Posts.OrderByDescending(z => z.CreatedDate).Take(1),
        (topic, post) => new {topic.Id, topic.Title, post.Text, post.CreatedDate})
   .OrderByDescending(x => x.CreatedDate)
   .ToList();

```
Basically what I'm doing now is after running

```
var topics = _context.Posts.GroupBy(x => x.TopicId, (x, y) => new
            {
                CreatedDate = y.Max(z => z.CreatedDate),
                TopicId = x,
            }).ToList();

```

I build the following query:

```
Expression<Func<Post, bool>> lastPostsQuery = post => false;
foreach (var topic in topics) 
{
    lastPostsQuery = lastPostsQuery.Or(post => post.TopicId == topic.TopicId && post.CreatedDate = topic.CreatedDate); //.Or is implemented in PredicateBuilder
}
var lastPosts = _context.Posts.Where(lastPostsQuery).ToList();

```

Which results in one query (instead of N) like `SELECT * FROM Posts WHERE (Posts.TopicId == 1 AND Posts.CreatedDate = '2017-08-01') OR (Posts.TopicId == 2 AND Posts.CreatedDate = '2017-08-02') OR ...`.

Not extremely efficient but since the number of topics per page is quite low it does the trick.