def renumerate_article_sortorder(apps, schema_editor):
    """ Renumerate articles for consistent and guaranteed unique sortorder. """
    Message = apps.get_model('newsletter', 'Message')
    for message in Message.objects.all():
        for index, article in enumerate(message.articles.all()):
            article.sortorder = (index + 1) * 10
            article.save()
