var add = function(alert){
        if(typeof alert.id === 'undefined'){
          alert.id = generateId();
        }
        $rootScope.alerts[alert.id] = alert;