entryAttachment.setFileData(IOUtils.toByteArray(file.getInputStream()));
entryAttachment.setContentType(file.getContentType());
Entry entry = entryService.findById(blogId);
entryAttachment.setEntry(entry);
entry.addAttachment(entryAttachment);
entryService.save(entry);
} else {
// Construct Attachment object
CommentAttachment commentAttachment = new CommentAttachment();
commentAttachment.setFileName(getFileName(file));