It's the exact same code that we have in MessageManager. I think we should have an helper function somewhere.

My preference would be to add a function in NotificationHelper we have in shared:

```javascript
NotificationHelper.close({ tag: targetTag });
```

Then NotificationHelper.close would be something like:
```javascript
var NotificationHelper = {
  ...
  close: function(query) {
    return Notification.get(query).then(
        function onSuccess(notifications) {
          for (var i = 0; i < notifications.length; i++) {
            notifications[i].close();
          }
        }).catch(function onError(reason) {
          console.error('Notification.get(tag: ' + targetTag + '): ',
            reason);
         }
      );
  }
};
```

Note that I put the onError function inside a `catch` handler that I call _after_ then, so that any error that happens inside the first `then` is also caught here. I also add the reason using a comma instead of a string concatenation, so that we see the whole exception stack.

And last but not least, I make `close` return a promise.

Then we could use this in both places, and maybe in others later, and probably other apps could use it as well.