public static void writeBook(Thread thread) {
		// Create new Book
		Book book = new Book();

		addMetadata(thread, book);
		
		for (Post post : thread.getPosts()) {
			book.addSection(post.getPostCount(), ResourceCreator.getResource(post));
		}
		
		for (String name : thread.getImages()) {
			String link = name.replaceFirst("./", "C:/Users/Tonis/Desktop/");
//			int index = link.lastIndexOf("/");
//			String name = link.substring(index + 1, link.length());
			log.info(name + " : " + link);
			try {
				FileInputStream in = new FileInputStream(link);
				Resource res = new Resource(in, name);
				book.addResource(res);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
		try {
			writeEpub(book);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}