protected async Task<Boolean> AddFormatToDocumentFromObject(string tenantId,
       String queueName,
       String jobId,
       Client.Model.DocumentFormat format,
       Object obj,
       String originalFileName,
       IDictionary<string, object> customData)
 {
     DocumentStoreServiceClient client = GetDocumentStoreClient(tenantId);
     AddFormatFromObjectToDocumentModel model = new AddFormatFromObjectToDocumentModel
     {
         CreatedById = this.PipelineId,
         JobId = jobId,
         QueueName = queueName,
         Format = format,
         FileName = originalFileName,
         StringContent = JsonConvert.SerializeObject(obj),
     };
     var response = await client.AddFormatToDocument(model, customData);
     return response != null;
 }
        public async void can_add_new_format_with_api_from_object()
        {
            //Upload original
            var handle = new DocumentHandle("Add_Format_Test");
            await _documentStoreClient.UploadAsync(TestConfig.PathToOpenDocumentText, handle);

            // wait background projection polling
            await UpdateAndWaitAsync();

            DocumentContent content = new DocumentContent(new DocumentContent.DocumentPage[]
            {
                new DocumentContent.DocumentPage(1, "TEST"), 
            }, new DocumentContent.MetadataHeader[] { });
            //now add format to document.
            AddFormatFromObjectToDocumentModel model = new AddFormatFromObjectToDocumentModel();
            model.DocumentHandle = handle;
            model.StringContent = JsonConvert.SerializeObject(content);
            model.CreatedById = "tika";
            model.FileName = "add_format_test.content";
            model.Format = new DocumentFormat("content");
            await _documentStoreClient.AddFormatToDocument(model, new Dictionary<String, Object>());

            // wait background projection polling
            await UpdateAndWaitAsync();
            var formats = await _documentStoreClient.GetFormatsAsync(handle);
            Assert.NotNull(formats);
            Assert.IsTrue(formats.HasFormat(new DocumentFormat("original")));
            Assert.IsTrue(formats.HasFormat(new DocumentFormat("content")));
            Assert.That(formats, Has.Count.EqualTo(2));

            await CompareDownloadedStreamToStringContent(
                model.StringContent,
                _documentStoreClient.OpenRead(handle, new DocumentFormat("content")));

        }