@SuppressWarnings("unchecked")
	public int addPhoto(String filename, String caption, String albumName, File pic) {
		Photo p = new Photo(filename, GuiView.control.getCurrentUser().getID(), caption, albumName, pic);
		if (GuiView.control.getCurrentUser().getAlbumList().containsKey(albumName)) {
			
			Iterator it = GuiView.control.getCurrentUser().getAlbumList().entrySet().iterator();
			while (it.hasNext()) {
				Map.Entry<String, Album> pairs = (Map.Entry<String, Album>) it.next();
				if (pairs.getValue().getPhotoList().containsKey(filename)) {
					for (int x = 0; x < pairs.getValue().getPhotoList().get(filename).getAlbums().size(); x++) {
						if (!p.getAlbums().contains(pairs.getValue().getPhotoList().get(filename).getAlbums().get(x)))
							p.addAlbum(pairs.getValue().getPhotoList().get(filename).getAlbums().get(x));
					}
					if (!pairs.getValue().getPhotoList().get(filename).getAlbums().contains(albumName))
						pairs.getValue().getPhotoList().get(filename).getAlbums().add(albumName);
					if (!p.getAlbums().contains(albumName))
						p.addAlbum(albumName);
				}
			}
			
			if (!GuiView.control.getCurrentUser().getAlbumList().get(albumName).getPhotoList().containsKey(filename)) {
				GuiView.control.getCurrentUser().getAlbumList().get(albumName).addPhoto(p);
				return 1; // photo has been successfully added
			}
			else{
				return 2; //photo already exists in album
			}
		}else{
			return 3; // album does not exist
		}
	}