I have the following function:
 function retrieveNotifications(promotions) {
         promotions.forEach( function(promotion) {
             //find all notification groups that have to be notified
             db
               .Notification
                   .findAll()
                       .then(function (notifications) {
                           //some code that adds notifications to an object
                        });                       
         });         
  };
How can I restructure it to wait till all notifications are added to the object. I can't use .then because it would be called multiple times because of the forEach
 
     
     
     
    