function savelesson(){
	lessons.fetch({query: 'select * from '+ lessons.config.adapter.collection_name});
	videos.fetch({query: 'select * from '+ videos.config.adapter.collection_name});
	if (lessons.length == 0 && videos.length == 0 ){
		
		for (var l in lsname ){
			
		var save_lesson = Alloy.createModel('lesson', {
				parent_id : lsname[l].parent_id,
		        lsn_id : lsname[l].lsn_id,
		        lsn_title : lsname[l].lsn_title,
		        video_id : lsname[l].video_id,
		        video_data : lsname[l].video_data
		    });
			
			lessons.add(save_lesson);
			save_lesson.save();
			
		}
		for (var v in vid_data ){
			
		var save_vid = Alloy.createModel('video_lessons', {
		        video_id : vid_data[v].video_id,
		        video_data : vid_data[v].video_data
		    });
			
			videos.add(save_vid);
			save_vid.save();
			
		}
	}else {
		console.log("there are records, no need to save");
	}
		
}
//static save list of lessons (temp)
static save list of lessons (temp)
static save list of lessons ( temp )
function savelesson(){
	lessons.fetch({query: 'select * from '+ lessons.config.adapter.collection_name});
	videos.fetch({query: 'select * from '+ videos.config.adapter.collection_name});
	if (lessons.length == 0 && videos.length == 0 ){
		for (var l in lsname ){
		var save_lesson = Alloy.createModel('lesson', {
				parent_id : lsname[l].parent_id,
		        lsn_id : lsname[l].lsn_id,
		        lsn_title : lsname[l].lsn_title,
		        video_id : lsname[l].video_id,
		        video_data : lsname[l].video_data
		    });
			lessons.add(save_lesson);
			save_lesson.save();
		}
		for (var v in vid_data ){
		var save_vid = Alloy.createModel('video_lessons', {
		        video_id : vid_data[v].video_id,
		        video_data : vid_data[v].video_data
		    });
			videos.add(save_vid);
			save_vid.save();
		}
	}else {
		console.log("there are records, no need to save");
	}
}
function savelesson ( ) { lessons . fetch ( { query : 'select * from ' + lessons . config . adapter . collection_name } ) ; videos . fetch ( { query : 'select * from ' + videos . config . adapter . collection_name } ) ; if ( lessons . length == 0 && videos . length == 0 ) { for ( var l in lsname ) { var save_lesson = Alloy . createModel ( 'lesson' , { parent_id : lsname [ l ] . parent_id , lsn_id : lsname [ l ] . lsn_id , lsn_title : lsname [ l ] . lsn_title , video_id : lsname [ l ] . video_id , video_data : lsname [ l ] . video_data } ) ; lessons . add ( save_lesson ) ; save_lesson . save ( ) ; } for ( var v in vid_data ) { var save_vid = Alloy . createModel ( 'video_lessons' , { video_id : vid_data [ v ] . video_id , video_data : vid_data [ v ] . video_data } ) ; videos . add ( save_vid ) ; save_vid . save ( ) ; } } else { console . log ( "there are records, no need to save" ) ; } }
static save list of lessons (temp)
static save list of lessons ( temp )