public async Task ExportAllItemsToFile(Admin admin, IEnumerable <Item> items, bool logInfoNeeded, string folderToSave) { await Task.Run(() => { var attachmentPath = _importService.ExportItemsToFile(items, folderToSave); if (logInfoNeeded) { var email = new Email() { ToName = admin.Name, ToAddress = admin.Email, Subject = "Export", Body = "", AttachmentPath = attachmentPath }; email.Body = "All of the items were successfully exported"; _emailService.SendEmail(email); } }); }