try {
task = dao.fetchTaskIfExists(taskID);
availableTask = task instanceof ITaskWithAttachments && task.isAvailableTo(credentials);
if (availableTask) {
ITaskWithAttachments taskWithAttachments = (ITaskWithAttachments) task;
Attachment removedAttachment = taskWithAttachments.removeAttachment(attachmentURL);
availableAttachment = (removedAttachment != null);
if (availableAttachment) {
dao.updateTask(task);
dao.commit();
if (_logger.isDebugEnabled())