public void setTags(FileObject f,Picture picture){
		if(picture != null){
			if(f.getTags() != null){
				List<String> tags = new ArrayList<String>();
				for(String tagg: f.getTags()){
					String tgg ="";
					try{
						tgg = tagg.toLowerCase();
						String s = tagg.charAt(0) + "";
						tgg = s.toUpperCase() + tgg.substring(1);
					}catch(Exception u){
						Log.getLogger().log(Level.SEVERE, "Unexpected problems with the String " + tagg);
					}
					tags.add(tgg);
				}
				List<String> pictags = new ArrayList<String>();
				for(TagObject tagg: picture.getTags()){
					pictags.add(tagg.getTag());
				}

				for(int i = 0; i <tags.size();i++){	
					if(!(pictags.contains(tags.get(i)) && tags.get(i).equals(""))){
						TagI tag= tagDao.findById(tags.get(i));

						if((tag!=null)){
							beginTransaction();
							List<PictureI> ptag =new ArrayList<PictureI>();
							try{
								ptag= (List<PictureI>) tag.getPictures();
							}catch(Exception e){
								ptag = new ArrayList<PictureI>();
							}
							if(!(ptag.contains(picture)))
								ptag.add(picture);
							tag.setPictures(ptag);
							List<TagI> pTags = new ArrayList<TagI>();
							try{
								pTags = (List<TagI>) picture.getTags();
							}catch(Exception e){
								pTags = new ArrayList<TagI>();
							}
							if(!(pTags.contains(tag))){
								pTags.add(tag);

								picture.setTags(pTags);
								commitTransaction();
							}
						}else{
							beginTransaction();
							tag = new Tag();
							tag.setTag(tags.get(i));			
							List<Picture> peg = new ArrayList<Picture>();
							peg.add(picture);
							tag.setPictures(peg);
							List<TagI> pTags;
							try{
							 pTags = (List<TagI>) picture.getTags();
							}catch(Exception e){
								 pTags = new ArrayList<TagI>();
							}
							if(pTags==null)
								pTags = new ArrayList<TagI>();
							pTags.add(tag);		
							picture.setTags(pTags);
							entityManager.persist(tag);
							commitTransaction();
						}
					}
				}

			}
		}
	}