Box representation of a metadata template field
 private async Task<BoxMetadataTemplate> createTestTemplate(string templateKey)
 {
     var field1 = new BoxMetadataTemplateField() { Key = "attr1", DisplayName = "a string", Type = "string", Hidden = true };
     var field2 = new BoxMetadataTemplateField() { Key = "attr2", DisplayName = "a float", Type = "float" };
     var field3 = new BoxMetadataTemplateField() { Key = "attr3", DisplayName = "a date", Type = "date" };
     var options = new List<BoxMetadataTemplateFieldOption>() { new BoxMetadataTemplateFieldOption() { Key = "value1" }, new BoxMetadataTemplateFieldOption() { Key = "value2" } };
     var field4 = new BoxMetadataTemplateField() { Key = "attr4", DisplayName = "a enum", Type = "enum", Options = options };
     var fields = new List<BoxMetadataTemplateField>() { field1, field2, field3, field4 };
     var templateToCreate = new BoxMetadataTemplate() { TemplateKey = templateKey, DisplayName = templateKey, Fields = fields, Hidden = true, Scope = SCOPE };
     var createdTemplate = await _client.MetadataManager.CreateMetadataTemplate(templateToCreate);
     return createdTemplate;
 }
        // This test is disabled because our test account has hit the maximum number of metadata templates (50).
        // Until we can figure out how to delete some templates or increase the limit this test will fail.
        //[TestMethod]
        public async Task Metadata_UpdateTemplate_LiveSession()
        {
            var templateKey = "template-" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 8);
            var createdTemplate = await createTestTemplate(templateKey);

            //addField operation
            var newField = new BoxMetadataTemplateField() { Key = "attr5", DisplayName = "a string", Type = "string" };
            var update = new BoxMetadataTemplateUpdate() { Op = MetadataTemplateUpdateOp.addField, Data = newField };
            var updates = new List<BoxMetadataTemplateUpdate>() { update };
            var updatedTemplate = await _client.MetadataManager.UpdateMetadataTemplate(updates, "enterprise", templateKey);
            Assert.IsTrue(updatedTemplate.Fields.Any(f => f.Key == "attr5"), "addField operation failed on metadata update");

            //editField operation
            var fieldUpdate = new BoxMetadataTemplateField() { DisplayName = "a string edited"};
            update = new BoxMetadataTemplateUpdate() { Op = MetadataTemplateUpdateOp.editField, FieldKey="attr1", Data = fieldUpdate };
            updates = new List<BoxMetadataTemplateUpdate>() { update };
            updatedTemplate = await _client.MetadataManager.UpdateMetadataTemplate(updates, "enterprise", templateKey);
            Assert.IsTrue(updatedTemplate.Fields.Single(f => f.Key == "attr1").DisplayName == "a string edited", "editField operation failed on metadata update");

            //editTemplate operation
            var templateUpdate = new BoxMetadataTemplate() { DisplayName = "new display name" };
            update = new BoxMetadataTemplateUpdate() { Op = MetadataTemplateUpdateOp.editTemplate, Data = templateUpdate };
            updates = new List<BoxMetadataTemplateUpdate>() { update };
            updatedTemplate = await _client.MetadataManager.UpdateMetadataTemplate(updates, "enterprise", templateKey);
            Assert.IsTrue(updatedTemplate.DisplayName == "new display name", "editTemplate operation failed on metadata update");

            //addEnumOption operation
            var newValue = new BoxMetadataTemplateFieldOption() { Key = "value3" };
            update = new BoxMetadataTemplateUpdate() { Op = MetadataTemplateUpdateOp.addEnumOption, FieldKey = "attr4", Data = newValue };
            updates = new List<BoxMetadataTemplateUpdate>() { update };
            updatedTemplate = await _client.MetadataManager.UpdateMetadataTemplate(updates, "enterprise", templateKey);
            Assert.IsTrue(updatedTemplate.Fields.Single(f => f.Key == "attr4").Options.Count == 3, "addEnumOption operation failed on metadata update");

            //reorderEnumOptions operation
            var newValueOrder = new List<string>() { "value2", "value1", "value3" };
            update = new BoxMetadataTemplateUpdate() { Op = MetadataTemplateUpdateOp.reorderEnumOptions, FieldKey = "attr4", EnumOptionKeys = newValueOrder };
            updates = new List<BoxMetadataTemplateUpdate>() { update };
            updatedTemplate = await _client.MetadataManager.UpdateMetadataTemplate(updates, "enterprise", templateKey);
            Assert.IsTrue(updatedTemplate.Fields.Single(f => f.Key == "attr4").Options[0].Key == "value2", "reorderEnumOptions operation failed on metadata update");

            //reorderFields operation
            var newFieldOrder = new List<string>() { "attr5", "attr4", "attr3", "attr2", "attr1" };
            update = new BoxMetadataTemplateUpdate() { Op = MetadataTemplateUpdateOp.reorderFields, FieldKeys=newFieldOrder };
            updates = new List<BoxMetadataTemplateUpdate>() { update };
            updatedTemplate = await _client.MetadataManager.UpdateMetadataTemplate(updates, "enterprise", templateKey);
            Assert.IsTrue(updatedTemplate.Fields[0].Key == "attr5", "reorderFields operation failed on metadata update");

        }