public async Task Map_NestedTopics_ReturnsMappedTopic() {

      var mappingService        = new ReverseTopicMappingService(_topicRepository);
      var bindingModel          = new ContentTypeDescriptorTopicBindingModel("Test");

      bindingModel.Attributes.Add(new TextAttributeTopicBindingModel("Attribute1"));
      bindingModel.Attributes.Add(new TextAttributeTopicBindingModel("Attribute2"));
      bindingModel.Attributes.Add(new TextAttributeTopicBindingModel("Attribute3") { DefaultValue = "New Value" });

      var topic                 = TopicFactory.Create("Test", "ContentTypeDescriptor");
      var attributes            = TopicFactory.Create("Attributes", "List", topic);

      var attribute3            = (AttributeDescriptor)TopicFactory.Create("Attribute3", "TextAttribute", attributes);
      var attribute4            = TopicFactory.Create("Attribute4", "TextAttribute", attributes);

      attribute3.DefaultValue   = "Original Value";

      var target                = (ContentTypeDescriptor?)await mappingService.MapAsync(bindingModel, topic).ConfigureAwait(false);

      Assert.AreEqual<int>(3, target.AttributeDescriptors.Count);
      Assert.IsNotNull(target.AttributeDescriptors.GetTopic("Attribute1"));
      Assert.IsNotNull(target.AttributeDescriptors.GetTopic("Attribute2"));
      Assert.IsNotNull(target.AttributeDescriptors.GetTopic("Attribute3"));
      Assert.AreEqual<string>("New Value", target.AttributeDescriptors.GetTopic("Attribute3").DefaultValue);
      Assert.IsNull(target.AttributeDescriptors.GetTopic("Attribute4"));

    }
    public async Task Map_Relationships_ReturnsMappedTopic() {

      var mappingService        = new ReverseTopicMappingService(_topicRepository);
      var bindingModel          = new ContentTypeDescriptorTopicBindingModel("Test");
      var contentTypes          = _topicRepository.GetContentTypeDescriptors();
      var topic                 = (ContentTypeDescriptor)TopicFactory.Create("Test", "ContentTypeDescriptor");

      topic.Relationships.SetTopic("ContentTypes", contentTypes[4]);

      for (var i = 0; i < 3; i++) {
        bindingModel.ContentTypes.Add(
          new() {
            UniqueKey = contentTypes[i].GetUniqueKey()
          }
        );
      }

      var target                = (ContentTypeDescriptor?)await mappingService.MapAsync(bindingModel, topic).ConfigureAwait(false);

      Assert.AreEqual<int>(3, target.PermittedContentTypes.Count);
      Assert.IsTrue(target.PermittedContentTypes.Contains(contentTypes[0]));
      Assert.IsTrue(target.PermittedContentTypes.Contains(contentTypes[1]));
      Assert.IsTrue(target.PermittedContentTypes.Contains(contentTypes[2]));
      Assert.IsFalse(target.PermittedContentTypes.Contains(contentTypes[3]));

    }