'Add an app to this collection. If specified, the app will be created
with the specified `order`. If not, it will be added to the end of the
collection.'

def add_app(self, app, order=None):

    qs = self.membership_class.objects.filter(obj=self)
    if (order is None):
        aggregate = qs.aggregate(models.Max('order'))['order__max']
        order = ((aggregate + 1) if (aggregate is not None) else 0)
    if app.is_homescreen():
        raise ValueError('Cannot    add    homescreens    to    feed')
    rval = self.membership_class.objects.create(obj=self, app=app, order=order)
    index_webapps.delay([app.pk])
    return rval
