public async Task <bool> DeleteAttachmentByTask(int taskId) { var attachments = await attachmentRepository.GetAttachmentByTask(taskId); if (attachments.Count().Equals(0)) { return(false); } foreach (Attachment attachment in attachments) { await DeleteAttachment(attachment.Id); } return(true); }