public override async Task Run()
        {
            if (string.IsNullOrEmpty(ActivityUI.FileNameTextBox.Value))
            {
                RaiseError("No file name was given on design time", ActivityErrorCode.DESIGN_TIME_DATA_MISSING);
                return;
            }

            //we should upload this file to our file storage
            var userSelectedFileManifest = Payload.CrateContentsOfType <StandardFileDescriptionCM>().FirstOrDefault();

            if (userSelectedFileManifest == null)
            {
                RaiseError("No StandardFileDescriptionCM Crate was found", ActivityErrorCode.PAYLOAD_DATA_MISSING);
            }

            var fileContents = userSelectedFileManifest.TextRepresentation;

            using (var stream = GenerateStreamFromString(fileContents))
            {
                //TODO what to do with this fileDO??
                var fileDO = await HubCommunicator.SaveFile(ActivityUI.FileNameTextBox.Value, stream);
            }
            Success();
        }
        private async Task <string> AppendOrCreateSpreadsheet(StandardTableDataCM tableToSave)
        {
            byte[] fileData;
            string fileName;

            if (ActivityUI.UseNewSpreadsheetOption.Selected)
            {
                fileData = ExcelUtils.CreateExcelFile(
                    tableToSave,
                    ActivityUI.NewWorksheetName.Value
                    );

                fileName = ActivityUI.NewSpreadsheetName.Value;
            }
            else
            {
                var existingFileStream = await HubCommunicator.DownloadFile(
                    int.Parse(ActivityUI.ExistingSpreadsheetsList.Value)
                    );

                byte[] existingFileBytes;
                using (var memStream = new MemoryStream())
                {
                    await existingFileStream.CopyToAsync(memStream);

                    existingFileBytes = memStream.ToArray();
                }

                fileName = ActivityUI.ExistingSpreadsheetsList.selectedKey;

                var worksheetName = ActivityUI.UseNewWorksheetOption.Selected
                    ? ActivityUI.NewWorksheetName.Value
                    : ActivityUI.ExistingWorksheetsList.selectedKey;

                StandardTableDataCM dataToInsert;
                if (ActivityUI.UseExistingWorksheetOption.Selected ||
                    ActivityUI.ExistingWorksheetsList.ListItems.Any(x => x.Key == ActivityUI.NewWorksheetName.Value))
                {
                    var existingData = _excelUtils.GetExcelFile(existingFileBytes, fileName, true, worksheetName);

                    StandardTableDataCMTools.AppendToStandardTableData(existingData, tableToSave);
                    dataToInsert = existingData;
                }
                else
                {
                    dataToInsert = tableToSave;
                }

                fileData = ExcelUtils.RewriteSheetForFile(
                    existingFileBytes,
                    dataToInsert,
                    worksheetName
                    );
            }

            using (var stream = new MemoryStream(fileData, false))
            {
                if (!fileName.ToUpper().EndsWith(".XLSX"))
                {
                    fileName += ".xlsx";
                }

                var file = await HubCommunicator.SaveFile(fileName, stream);

                Payload.Add(Crate.FromContent("StoredFile", new StandardFileDescriptionCM
                {
                    Filename           = file.Id.ToString(),    // dirty hack
                    TextRepresentation = file.OriginalFileName, // another hack
                    Filetype           = ".xlsx"
                }));
                return(file.CloudStorageUrl);
            }
        }