if(! FileUtils.getExtension(file.getName()).equals(IMAGE_FORMAT))
file = new File(file.getPath() + '.' + IMAGE_FORMAT);
final URI uri = LinkController.toLinkTypeDependantURI(mindmapFile, file);
ImageIO.write(image, IMAGE_FORMAT, file);
final NodeModel node = mapController.newNode(file.getName(), target.getMap());
final ExternalResource extension = new ExternalResource(uri);
node.addExtension(extension);
mapController.insertNode(node, target, asSibling, isLeft, isLeft);
}
catch (IOException e) {
e.printStackTrace();