Message message;
if (file.getSize() > 0) {
if (uploadType.equalsIgnoreCase("entry")) {
// Construct Attachment object
EntryAttachment entryAttachment = new EntryAttachment();
entryAttachment.setFileName(getFileName(file));
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();