function editArticleInList(articles, level, newArticle) {
    return articles.map(function(article) {
        var articleLevel = article.getLevel();

        if (articleLevel === level) {
            // it is the article to edit
            return article.merge(newArticle);
        } else if (level.indexOf(articleLevel) === 0) {
            // it is a parent
            var articles = editArticleInList(article.getArticles(), level, newArticle);
            return article.set('articles', articles);
        } else {
            // This is not the article you are looking for
            return article;
        }
    });
}
function editArticleInList(articles, level, newArticle) {
    return articles.map(function(article) {
        var articleLevel = article.getLevel();

        if (articleLevel === level) {
            // it is the article to edit
            return article.merge(newArticle);
        } else if (level.indexOf(articleLevel) === 0) {
            // it is a parent
            var articles = editArticleInList(article.getArticles(), level, newArticle);
            return article.set('articles', articles);
        } else {
            // This is not the article you are looking for
            return article;
        }
    });
}
function editArticleInList ( articles , level , newArticle ) { return articles . map ( function ( article ) { var articleLevel = article . getLevel ( ) ; if ( articleLevel === level ) { // it is the article to edit return article . merge ( newArticle ) ; } else if ( level . indexOf ( articleLevel ) === 0 ) { // it is a parent var articles = editArticleInList ( article . getArticles ( ) , level , newArticle ) ; return article . set ( 'articles' , articles ) ; } else { // This is not the article you are looking for return article ; } } ) ; }
Edit a list of articles

@param {List<Article>} articles
@param {String} level
@param {Article} newArticle
@return {List<Article>}
Edit a list of articles
editArticleInList - edit article in list