diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java
index 04a8fc8..c0188d7 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java
@@ -25,6 +25,7 @@
 import java.util.Optional;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.be.components.impl.CommonImportManager.ElementTypeEnum;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
 import org.openecomp.sdc.be.model.Model;
@@ -48,20 +49,30 @@
     private final ModelOperation modelOperation;
 
     @Autowired
-    public CapabilityTypeImportManager(CapabilityTypeOperation capabilityTypeOperation, CommonImportManager commonImportManager, ModelOperation modelOperation) {
+    public CapabilityTypeImportManager(CapabilityTypeOperation capabilityTypeOperation, CommonImportManager commonImportManager,
+                                       ModelOperation modelOperation) {
         this.capabilityTypeOperation = capabilityTypeOperation;
         this.commonImportManager = commonImportManager;
         this.modelOperation = modelOperation;
     }
 
-    public Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> createCapabilityTypes(final String capabilityTypesYml, final String modelName) {
-        return commonImportManager.createElementTypes(capabilityTypesYml, capabilityTypesFromYml -> createCapabilityTypesFromYml(capabilityTypesYml, modelName), this::upsertCapabilityTypesByDao,
-            CommonImportManager.ElementTypeEnum.CAPABILITY_TYPE);
+    public Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> createCapabilityTypes(final String capabilityTypesYml,
+                                                                                                                final String modelName,
+                                                                                                                final boolean includeToModelDefaultImports) {
+        final Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> elementTypes = commonImportManager.createElementTypes(
+            capabilityTypesYml, capabilityTypesFromYml -> createCapabilityTypesFromYml(capabilityTypesYml, modelName),
+            this::upsertCapabilityTypesByDao, ElementTypeEnum.CAPABILITY_TYPE);
+        if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) {
+            commonImportManager.addTypesToDefaultImports(capabilityTypesYml, modelName);
+        }
+        return elementTypes;
     }
 
-    private Either<List<CapabilityTypeDefinition>, ActionStatus> createCapabilityTypesFromYml(final String capabilityTypesYml, final String modelName) {
-        final Either<List<CapabilityTypeDefinition>, ActionStatus> capabilityTypes = commonImportManager.createElementTypesFromYml(capabilityTypesYml, this::createCapabilityType);
-        if (capabilityTypes.isLeft() && StringUtils.isNotEmpty(modelName)){
+    private Either<List<CapabilityTypeDefinition>, ActionStatus> createCapabilityTypesFromYml(final String capabilityTypesYml,
+                                                                                              final String modelName) {
+        final Either<List<CapabilityTypeDefinition>, ActionStatus> capabilityTypes = commonImportManager.createElementTypesFromYml(capabilityTypesYml,
+            this::createCapabilityType);
+        if (capabilityTypes.isLeft() && StringUtils.isNotEmpty(modelName)) {
             final Optional<Model> modelOptional = modelOperation.findModelByName(modelName);
             if (modelOptional.isPresent()) {
                 capabilityTypes.left().value().forEach(capabilityType -> capabilityType.setModel(modelName));
@@ -75,7 +86,8 @@
     private Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> upsertCapabilityTypesByDao(
         List<CapabilityTypeDefinition> capabilityTypesToCreate) {
         return commonImportManager.createElementTypesByDao(capabilityTypesToCreate, capabilityType -> Either.left(ActionStatus.OK),
-            capabilityType -> new ImmutablePair<>(CommonImportManager.ElementTypeEnum.CAPABILITY_TYPE, UniqueIdBuilder.buildCapabilityTypeUid(capabilityType.getModel(), capabilityType.getType())),
+            capabilityType -> new ImmutablePair<>(CommonImportManager.ElementTypeEnum.CAPABILITY_TYPE,
+                UniqueIdBuilder.buildCapabilityTypeUid(capabilityType.getModel(), capabilityType.getType())),
             capabilityTypeOperation::getCapabilityType, capabilityTypeOperation::addCapabilityType, this::updateCapabilityType);
     }
 
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java
index 9a77aad..c0da9eb 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java
@@ -51,6 +51,7 @@
 import org.openecomp.sdc.be.model.normatives.ToscaTypeMetadata;
 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
 import org.openecomp.sdc.be.model.operations.api.TypeOperations;
+import org.openecomp.sdc.be.model.operations.impl.ModelOperation;
 import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
 import org.openecomp.sdc.common.log.wrappers.Logger;
 import org.openecomp.sdc.exception.ResponseFormat;
@@ -64,11 +65,15 @@
     private static final Logger log = Logger.getLogger(CommonImportManager.class.getName());
     private final ComponentsUtils componentsUtils;
     private final PropertyOperation propertyOperation;
+    private final ModelOperation modelOperation;
 
     @Autowired
-    public CommonImportManager(ComponentsUtils componentsUtils, PropertyOperation propertyOperation) {
+    public CommonImportManager(final ComponentsUtils componentsUtils,
+                               final PropertyOperation propertyOperation,
+                               final ModelOperation modelOperation) {
         this.componentsUtils = componentsUtils;
         this.propertyOperation = propertyOperation;
+        this.modelOperation = modelOperation;
     }
 
     public static void setProperties(Map<String, Object> toscaJson, Consumer<List<PropertyDefinition>> consumer) {
@@ -529,6 +534,10 @@
 
     }
 
+    public void addTypesToDefaultImports(final String typesYaml, final String modelName) {
+        modelOperation.addTypesToDefaultImports(typesYaml, modelName);
+    }
+
     public enum ElementTypeEnum {
         POLICY_TYPE, GROUP_TYPE, DATA_TYPE, CAPABILITY_TYPE, INTERFACE_LIFECYCLE_TYPE, RELATIONSHIP_TYPE
     }
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java
index 95ef74e..b24d81b 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java
@@ -37,7 +37,6 @@
 import org.openecomp.sdc.be.model.DataTypeDefinition;
 import org.openecomp.sdc.be.model.Model;
 import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.model.RelationshipTypeDefinition;
 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
 import org.openecomp.sdc.be.model.operations.impl.ModelOperation;
 import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
@@ -61,14 +60,21 @@
     @Resource
     private ModelOperation modelOperation;
 
-    public Either<List<ImmutablePair<DataTypeDefinition, Boolean>>, ResponseFormat> createDataTypes(final String dataTypeYml, final String modelName) {
-        return commonImportManager
-            .createElementTypes(dataTypeYml, dataTypesFromYml -> createDataTypesFromYml(dataTypeYml, modelName), this::createDataTypesByDao, ElementTypeEnum.DATA_TYPE);
+    public Either<List<ImmutablePair<DataTypeDefinition, Boolean>>, ResponseFormat> createDataTypes(final String dataTypeYml, final String modelName,
+                                                                                                    final boolean includeToModelDefaultImports) {
+        final var elementTypes = commonImportManager.createElementTypes(
+            dataTypeYml, dataTypesFromYml -> createDataTypesFromYml(dataTypeYml, modelName), this::createDataTypesByDao, ElementTypeEnum.DATA_TYPE);
+
+        if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) {
+            commonImportManager.addTypesToDefaultImports(dataTypeYml, modelName);
+        }
+        return elementTypes;
     }
-    
+
     private Either<List<DataTypeDefinition>, ActionStatus> createDataTypesFromYml(final String dataTypesYml, final String modelName) {
-        final Either<List<DataTypeDefinition>, ActionStatus> dataTypes = commonImportManager.createElementTypesFromYml(dataTypesYml, this::createDataType);
-        if (dataTypes.isLeft() && StringUtils.isNotEmpty(modelName)){
+        final Either<List<DataTypeDefinition>, ActionStatus> dataTypes = commonImportManager.createElementTypesFromYml(dataTypesYml,
+            this::createDataType);
+        if (dataTypes.isLeft() && StringUtils.isNotEmpty(modelName)) {
             final Optional<Model> modelOptional = modelOperation.findModelByName(modelName);
             if (modelOptional.isPresent()) {
                 dataTypes.left().value().forEach(dataType -> dataType.setModel(modelName));
@@ -83,7 +89,8 @@
         List<DataTypeDefinition> dataTypesToCreate) {
         return commonImportManager.createElementTypesByDao(dataTypesToCreate, this::validateDataType,
             dataType -> new ImmutablePair<>(ElementTypeEnum.DATA_TYPE, UniqueIdBuilder.buildDataTypeUid(dataType.getModel(), dataType.getName())),
-            dataTypeUid -> propertyOperation.getDataTypeByUidWithoutDerived(dataTypeUid, true), dataType -> propertyOperation.addDataType(dataType),
+            dataTypeUid -> propertyOperation.getDataTypeByUidWithoutDerived(dataTypeUid, true),
+            dataType -> propertyOperation.addDataType(dataType),
             (newDataType, oldDataType) -> propertyOperation.updateDataType(newDataType, oldDataType));
     }
 
@@ -136,7 +143,8 @@
         }
         String derivedDataType = dataType.getDerivedFromName();
         if (derivedDataType != null) {
-            Either<DataTypeDefinition, StorageOperationStatus> derivedDataTypeByName = propertyOperation.getDataTypeByName(derivedDataType, dataType.getModel());
+            Either<DataTypeDefinition, StorageOperationStatus> derivedDataTypeByName = propertyOperation.getDataTypeByName(derivedDataType,
+                dataType.getModel());
             if (derivedDataTypeByName.isRight()) {
                 StorageOperationStatus status = derivedDataTypeByName.right().value();
                 if (status == StorageOperationStatus.NOT_FOUND) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java
index e57c46b..e043bc2 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java
@@ -69,13 +69,20 @@
         this.modelOperation = modelOperation;
     }
 
-    public Either<List<ImmutablePair<GroupTypeDefinition, Boolean>>, ResponseFormat> createGroupTypes(ToscaTypeImportData toscaTypeImportData, String modelName) {
-        return commonImportManager.createElementTypes(toscaTypeImportData, this::createGroupTypesFromYml, this::upsertGroupTypesByDao, modelName);
+    public Either<List<ImmutablePair<GroupTypeDefinition, Boolean>>, ResponseFormat> createGroupTypes(ToscaTypeImportData toscaTypeImportData,
+                                                                                                      String modelName, final boolean includeToModelDefaultImports) {
+        final Either<List<ImmutablePair<GroupTypeDefinition, Boolean>>, ResponseFormat> elementTypes = commonImportManager.createElementTypes(
+            toscaTypeImportData, this::createGroupTypesFromYml, this::upsertGroupTypesByDao, modelName);
+        if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) {
+            commonImportManager.addTypesToDefaultImports(toscaTypeImportData.getToscaTypesYml(), modelName);
+        }
+        return elementTypes;
     }
 
     private Either<List<GroupTypeDefinition>, ActionStatus> createGroupTypesFromYml(String groupTypesYml, String modelName) {
-        Either<List<GroupTypeDefinition>, ActionStatus> groupTypes = commonImportManager.createElementTypesFromYml(groupTypesYml, this::createGroupType);
-        if (groupTypes.isLeft() && StringUtils.isNotEmpty(modelName)){
+        Either<List<GroupTypeDefinition>, ActionStatus> groupTypes = commonImportManager.createElementTypesFromYml(groupTypesYml,
+            this::createGroupType);
+        if (groupTypes.isLeft() && StringUtils.isNotEmpty(modelName)) {
             final Optional<Model> modelOptional = modelOperation.findModelByName(modelName);
             if (modelOptional.isPresent()) {
                 groupTypes.left().value().forEach(groupType -> groupType.setModel(modelName));
@@ -90,7 +97,8 @@
         List<GroupTypeDefinition> groupTypesToCreate, String modelName) {
         return commonImportManager.createElementTypesWithVersionByDao(groupTypesToCreate, this::validateGroupType,
             groupType -> new ImmutablePair<>(ElementTypeEnum.GROUP_TYPE, UniqueIdBuilder.buildGroupTypeUid(groupType.getModel(),
-                groupType.getType(), groupType.getVersion(), NodeTypeEnum.GroupType.getName()).toLowerCase()), groupTypeOperation::getLatestGroupTypeByType,
+                groupType.getType(), groupType.getVersion(), NodeTypeEnum.GroupType.getName()).toLowerCase()),
+            groupTypeOperation::getLatestGroupTypeByType,
             groupTypeOperation::addGroupType, this::updateGroupType, modelName);
     }
 
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java
index ef00d9a..5cc8985 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java
@@ -42,7 +42,6 @@
 import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation;
 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
 import org.openecomp.sdc.be.model.operations.impl.ModelOperation;
-import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
 import org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum;
 import org.openecomp.sdc.common.log.wrappers.Logger;
 import org.openecomp.sdc.exception.ResponseFormat;
@@ -63,14 +62,19 @@
     @Resource
     private ModelOperation modelOperation;
 
-    public Either<List<InterfaceDefinition>, ResponseFormat> createLifecycleTypes(String interfaceLifecycleTypesYml, final String modelName) {
+    public Either<List<InterfaceDefinition>, ResponseFormat> createLifecycleTypes(String interfaceLifecycleTypesYml, final String modelName,
+                                                                                  final boolean includeToModelDefaultImports) {
         Either<List<InterfaceDefinition>, ActionStatus> interfaces = createInterfaceTypeFromYml(interfaceLifecycleTypesYml, modelName);
         if (interfaces.isRight()) {
             ActionStatus status = interfaces.right().value();
             ResponseFormat responseFormat = componentsUtils.getResponseFormatByGroupType(status, null);
             return Either.right(responseFormat);
         }
-        return createInterfacesByDao(interfaces.left().value());
+        final Either<List<InterfaceDefinition>, ResponseFormat> elementTypes = createInterfacesByDao(interfaces.left().value());
+        if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) {
+            commonImportManager.addTypesToDefaultImports(interfaceLifecycleTypesYml, modelName);
+        }
+        return elementTypes;
     }
 
     private Either<List<InterfaceDefinition>, ActionStatus> createInterfaceTypeFromYml(final String interfaceTypesYml, final String modelName) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java
index 9934939..1d34f39 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java
@@ -50,10 +50,10 @@
         this.modelOperation = modelOperation;
         this.dataTypeImportManager = dataTypeImportManager;
     }
-    
+
     public Model createModel(final Model model, final String datatypesYaml) {
         createModel(model);
-        dataTypeImportManager.createDataTypes(datatypesYaml, model.getName());
+        dataTypeImportManager.createDataTypes(datatypesYaml, model.getName(), false);
         return model;
     }
 
@@ -119,4 +119,4 @@
             throw ModelOperationExceptionSupplier.couldNotReadImports().get();
         }
     }
-}
\ No newline at end of file
+}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
index a3a2c01..54d5780 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java
@@ -69,13 +69,21 @@
         this.modelOperation = modelOperation;
     }
 
-    public Either<List<ImmutablePair<PolicyTypeDefinition, Boolean>>, ResponseFormat> createPolicyTypes(ToscaTypeImportData toscaTypeImportData, String modelName) {
-        return commonImportManager.createElementTypes(toscaTypeImportData, this::createPolicyTypesFromYml, this::upsertPolicyTypesByDao, modelName);
+    public Either<List<ImmutablePair<PolicyTypeDefinition, Boolean>>, ResponseFormat> createPolicyTypes(final ToscaTypeImportData toscaTypeImportData,
+                                                                                                        final String modelName,
+                                                                                                        final boolean includeToModelDefaultImports) {
+        final Either<List<ImmutablePair<PolicyTypeDefinition, Boolean>>, ResponseFormat> elementTypes = commonImportManager.createElementTypes(
+            toscaTypeImportData, this::createPolicyTypesFromYml, this::upsertPolicyTypesByDao, modelName);
+        if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) {
+            commonImportManager.addTypesToDefaultImports(toscaTypeImportData.getToscaTypesYml(), modelName);
+        }
+        return elementTypes;
     }
 
     private Either<List<PolicyTypeDefinition>, ActionStatus> createPolicyTypesFromYml(String policyTypesYml, String modelName) {
-        Either<List<PolicyTypeDefinition>, ActionStatus> policyTypes = commonImportManager.createElementTypesFromYml(policyTypesYml, this::createPolicyType);
-        if (policyTypes.isLeft() && StringUtils.isNotEmpty(modelName)){
+        Either<List<PolicyTypeDefinition>, ActionStatus> policyTypes = commonImportManager.createElementTypesFromYml(policyTypesYml,
+            this::createPolicyType);
+        if (policyTypes.isLeft() && StringUtils.isNotEmpty(modelName)) {
             final Optional<Model> modelOptional = modelOperation.findModelByName(modelName);
             if (modelOptional.isPresent()) {
                 policyTypes.left().value().forEach(policyType -> policyType.setModel(modelName));
@@ -90,7 +98,8 @@
         List<PolicyTypeDefinition> policyTypesToCreate, String modelName) {
         return commonImportManager.createElementTypesWithVersionByDao(policyTypesToCreate, this::validatePolicyType,
             policyType -> new ImmutablePair<>(ElementTypeEnum.POLICY_TYPE, UniqueIdBuilder.buildPolicyTypeUid(policyType.getModel(),
-                policyType.getType(), policyType.getVersion(), NodeTypeEnum.PolicyType.getName()).toLowerCase()), policyTypeOperation::getLatestPolicyTypeByType,
+                policyType.getType(), policyType.getVersion(), NodeTypeEnum.PolicyType.getName()).toLowerCase()),
+            policyTypeOperation::getLatestPolicyTypeByType,
             policyTypeOperation::addPolicyType, this::updatePolicyType, modelName);
     }
 
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java
index 2165b9f..564eb3a 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java
@@ -52,21 +52,31 @@
         this.modelOperation = modelOperation;
     }
 
-    public Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat> createRelationshipTypes(final String relationshipYml, final String modelName) {
-        return createRelationshipTypes(relationshipYml, modelName, false);
+    public Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat> createRelationshipTypes(final String relationshipYml,
+                                                                                                                    final String modelName,
+                                                                                                                    final boolean includeToModelDefaultImports) {
+        return createRelationshipTypes(relationshipYml, modelName, false, includeToModelDefaultImports);
     }
 
     private Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat> createRelationshipTypes(final String relationshipTypeYml,
-                                                                                                                     final String modelName, final boolean inTransaction) {
-        return commonImportManager
+                                                                                                                     final String modelName,
+                                                                                                                     final boolean inTransaction,
+                                                                                                                     final boolean includeToModelDefaultImports) {
+        final Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat> elementTypes = commonImportManager
             .createElementTypes(relationshipTypeYml, relationshipTypesFromYml -> createRelationshipTypesFromYml(relationshipTypeYml, modelName),
                 relationshipTypesToCreate -> createRelationshipTypesByDao(relationshipTypesToCreate, inTransaction),
                 ElementTypeEnum.RELATIONSHIP_TYPE);
+        if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) {
+            commonImportManager.addTypesToDefaultImports(relationshipTypeYml, modelName);
+        }
+        return elementTypes;
     }
 
-    private Either<List<RelationshipTypeDefinition>, ActionStatus> createRelationshipTypesFromYml(final String relationshipTypeYml, final String modelName) {
-        final Either<List<RelationshipTypeDefinition>, ActionStatus> relationshipTypes =  commonImportManager.createElementTypesFromYml(relationshipTypeYml, this::createRelationshipType);
-        if (relationshipTypes.isLeft() && StringUtils.isNotEmpty(modelName)){
+    private Either<List<RelationshipTypeDefinition>, ActionStatus> createRelationshipTypesFromYml(final String relationshipTypeYml,
+                                                                                                  final String modelName) {
+        final Either<List<RelationshipTypeDefinition>, ActionStatus> relationshipTypes = commonImportManager.createElementTypesFromYml(
+            relationshipTypeYml, this::createRelationshipType);
+        if (relationshipTypes.isLeft() && StringUtils.isNotEmpty(modelName)) {
             final Optional<Model> modelOptional = modelOperation.findModelByName(modelName);
             if (modelOptional.isPresent()) {
                 relationshipTypes.left().value().forEach(relationshipType -> relationshipType.setModel(modelName));
@@ -80,7 +90,8 @@
     private Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat> createRelationshipTypesByDao(
         List<RelationshipTypeDefinition> relationshipTypesToCreate, boolean inTransaction) {
         return commonImportManager.createElementTypesByDao(relationshipTypesToCreate, this::validateRelationshipType,
-            relationshipType -> new ImmutablePair<>(ElementTypeEnum.RELATIONSHIP_TYPE, UniqueIdBuilder.buildRelationshipTypeUid(relationshipType.getModel(), relationshipType.getType())),
+            relationshipType -> new ImmutablePair<>(ElementTypeEnum.RELATIONSHIP_TYPE,
+                UniqueIdBuilder.buildRelationshipTypeUid(relationshipType.getModel(), relationshipType.getType())),
             relationshipTypeUid -> relationshipTypeOperation.getRelationshipTypeByUid(relationshipTypeUid).right()
                 .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus),
             relationshipType -> relationshipTypeOperation.addRelationshipType(relationshipType, inTransaction),
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java
index 79982ea..b891789 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java
@@ -29,9 +29,7 @@
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.responses.ApiResponse;
 import io.swagger.v3.oas.annotations.servers.Server;
-import io.swagger.v3.oas.annotations.servers.Servers;
 import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.tags.Tags;
 import java.io.File;
 import java.io.IOException;
 import java.util.List;
@@ -66,6 +64,7 @@
 import org.openecomp.sdc.be.config.BeEcompErrorManager;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
+import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
 import org.openecomp.sdc.be.impl.ComponentsUtils;
 import org.openecomp.sdc.be.impl.ServletUtils;
 import org.openecomp.sdc.be.model.DataTypeDefinition;
@@ -76,11 +75,10 @@
 import org.openecomp.sdc.be.model.normatives.ToscaTypeMetadata;
 import org.openecomp.sdc.be.user.UserBusinessLogic;
 import org.openecomp.sdc.common.api.Constants;
-import org.openecomp.sdc.common.datastructure.FunctionalInterfaces.ConsumerThreeParam;
+import org.openecomp.sdc.common.datastructure.FunctionalInterfaces.ConsumerFourParam;
 import org.openecomp.sdc.common.datastructure.FunctionalInterfaces.ConsumerTwoParam;
 import org.openecomp.sdc.common.datastructure.Wrapper;
 import org.openecomp.sdc.common.log.wrappers.Logger;
-import org.openecomp.sdc.common.util.ValidationUtils;
 import org.openecomp.sdc.exception.ResponseFormat;
 import org.springframework.stereotype.Controller;
 
@@ -88,12 +86,14 @@
 @Path("/v1/catalog/uploadType")
 @Consumes(MediaType.MULTIPART_FORM_DATA)
 @Produces(MediaType.APPLICATION_JSON)
-@Tags({@Tag(name = "SDCE-2 APIs")})
-@Servers({@Server(url = "/sdc2/rest")})
+@Tag(name = "SDCE-2 APIs")
+@Server(url = "/sdc2/rest")
 @Controller
 public class TypesUploadServlet extends AbstractValidationsServlet {
 
-    public static final String CREATE = "Create ";
+    private static final String CREATE = "Create ";
+    private static final String START_HANDLE_REQUEST_OF = "Start handle request of {}";
+    private static final String CREATE_FAILED_WITH_EXCEPTION = "create {} failed with exception:";
     private static final Logger log = Logger.getLogger(TypesUploadServlet.class);
     private final CapabilityTypeImportManager capabilityTypeImportManager;
     private final InterfaceLifecycleTypeImportManager interfaceLifecycleTypeImportManager;
@@ -132,11 +132,13 @@
     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
     public Response uploadCapabilityType(@Parameter(description = "FileInputStream") @FormDataParam("capabilityTypeZip") File file,
                                          @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator,
-                                         @Parameter(description = "model") @FormDataParam("model") String modelName) {
-        final String sanitizedModelName = ValidationUtils.sanitizeInputString(modelName);
-        ConsumerThreeParam<Wrapper<Response>, String, String> createElementsMethod = (responseWrapper, ymlPayload, model) -> createElementsType(responseWrapper,
-            () -> capabilityTypeImportManager.createCapabilityTypes(ymlPayload, sanitizedModelName));
-        return uploadElementTypeServletLogic(createElementsMethod, file, request, creator, NodeTypeEnum.CapabilityType.name(), sanitizedModelName);
+                                         @Parameter(description = "model") @FormDataParam("model") String modelName,
+                                         @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) {
+        ConsumerFourParam<Wrapper<Response>, String, String, Boolean> createElementsMethod = (responseWrapper, ymlPayload, model, includeToModelImport) ->
+            createElementsType(responseWrapper, () -> capabilityTypeImportManager.createCapabilityTypes(ymlPayload, modelName,
+                includeToModelDefaultImports));
+        return uploadElementTypeServletLogic(createElementsMethod, file, request, creator, NodeTypeEnum.CapabilityType.name(), modelName,
+            includeToModelDefaultImports);
     }
 
     @POST
@@ -150,9 +152,10 @@
     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
     public Response uploadRelationshipType(@Parameter(description = "FileInputStream") @FormDataParam("relationshipTypeZip") File file,
                                            @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator,
-                                           @Parameter(description = "model") @FormDataParam("model") String modelName) {
-        modelName = ValidationUtils.sanitizeInputString(modelName);
-        return uploadElementTypeServletLogic(this::createRelationshipTypes, file, request, creator, NodeTypeEnum.RelationshipType.getName(), modelName);
+                                           @Parameter(description = "model") @FormDataParam("model") String modelName,
+                                           @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) {
+        return uploadElementTypeServletLogic(
+            this::createRelationshipTypes, file, request, creator, NodeTypeEnum.RelationshipType.getName(), modelName, includeToModelDefaultImports);
     }
 
     @POST
@@ -166,10 +169,11 @@
     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
     public Response uploadInterfaceLifecycleType(@Parameter(description = "FileInputStream") @FormDataParam("interfaceLifecycleTypeZip") File file,
                                                  @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator,
-                                                 @Parameter(description = "model") @FormDataParam("model") String modelName) {
-        final String sanitizedModelName = ValidationUtils.sanitizeInputString(modelName);
-        ConsumerTwoParam<Wrapper<Response>, String> createElementsMethod = (responseWrapper, ymlPayload) -> createElementsType(responseWrapper,
-            () -> interfaceLifecycleTypeImportManager.createLifecycleTypes(ymlPayload, sanitizedModelName));
+                                                 @Parameter(description = "model") @FormDataParam("model") String modelName,
+                                                 @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) {
+        ConsumerTwoParam<Wrapper<Response>, String> createElementsMethod = (responseWrapper, ymlPayload) ->
+            createElementsType(responseWrapper, () -> interfaceLifecycleTypeImportManager.createLifecycleTypes(ymlPayload, modelName,
+                includeToModelDefaultImports));
         return uploadElementTypeServletLogic(createElementsMethod, file, request, creator, "Interface Types");
     }
 
@@ -184,8 +188,8 @@
     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
     public Response uploadCategories(@Parameter(description = "FileInputStream") @FormDataParam("categoriesZip") File file,
                                      @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator) {
-        ConsumerTwoParam<Wrapper<Response>, String> createElementsMethod = (responseWrapper, ymlPayload) -> createElementsType(responseWrapper,
-            () -> categoriesImportManager.createCategories(ymlPayload));
+        ConsumerTwoParam<Wrapper<Response>, String> createElementsMethod = (responseWrapper, ymlPayload) ->
+            createElementsType(responseWrapper, () -> categoriesImportManager.createCategories(ymlPayload));
         return uploadElementTypeServletLogic(createElementsMethod, file, request, creator, "categories");
     }
 
@@ -200,9 +204,10 @@
     @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE)
     public Response uploadDataTypes(@Parameter(description = "FileInputStream") @FormDataParam("dataTypesZip") File file,
                                     @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator,
-                                    @Parameter(description = "model") @FormDataParam("model") String modelName) {
-        modelName = ValidationUtils.sanitizeInputString(modelName);
-        return uploadElementTypeServletLogic(this::createDataTypes, file, request, creator, NodeTypeEnum.DataType.getName(), modelName);
+                                    @Parameter(description = "model") @FormDataParam("model") String modelName,
+                                    @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) {
+        return uploadElementTypeServletLogic(this::createDataTypes, file, request, creator, NodeTypeEnum.DataType.getName(), modelName,
+            includeToModelDefaultImports);
     }
 
     @POST
@@ -217,10 +222,11 @@
     public Response uploadGroupTypes(@Parameter(description = "toscaTypeMetadata") @FormDataParam("toscaTypeMetadata") String toscaTypesMetaData,
                                      @Parameter(description = "model") @FormDataParam("model") String modelName,
                                      @Parameter(description = "FileInputStream") @FormDataParam("groupTypesZip") File file,
-                                     @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator) {
-        modelName = ValidationUtils.sanitizeInputString(modelName);
+                                     @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator,
+                                     @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) {
         Map<String, ToscaTypeMetadata> typesMetadata = getTypesMetadata(toscaTypesMetaData);
-        return uploadTypesWithMetaData(this::createGroupTypes, typesMetadata, file, request, creator, NodeTypeEnum.GroupType.getName(), modelName);
+        return uploadTypesWithMetaData(this::createGroupTypes, typesMetadata, file, request, creator, NodeTypeEnum.GroupType.getName(), modelName,
+            includeToModelDefaultImports);
     }
 
     @POST
@@ -235,10 +241,11 @@
     public Response uploadPolicyTypes(@Parameter(description = "toscaTypeMetadata") @FormDataParam("toscaTypeMetadata") String toscaTypesMetaData,
                                       @Parameter(description = "model") @FormDataParam("model") String modelName,
                                       @Parameter(description = "FileInputStream") @FormDataParam("policyTypesZip") File file,
-                                      @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator) {
-        modelName = ValidationUtils.sanitizeInputString(modelName);
+                                      @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator,
+                                      @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) {
         Map<String, ToscaTypeMetadata> typesMetadata = getTypesMetadata(toscaTypesMetaData);
-        return uploadTypesWithMetaData(this::createPolicyTypes, typesMetadata, file, request, creator, NodeTypeEnum.PolicyType.getName(), modelName);
+        return uploadTypesWithMetaData(this::createPolicyTypes, typesMetadata, file, request, creator, NodeTypeEnum.PolicyType.getName(), modelName,
+            includeToModelDefaultImports);
     }
 
     private Map<String, ToscaTypeMetadata> getTypesMetadata(String toscaTypesMetaData) {
@@ -247,13 +254,13 @@
     }
 
     private Response uploadElementTypeServletLogic(ConsumerTwoParam<Wrapper<Response>, String> createElementsMethod, File file,
-            final HttpServletRequest request, String creator, String elementTypeName) {
+                                                   final HttpServletRequest request, String creator, String elementTypeName) {
         init();
         String userId = initHeaderParam(creator, request, Constants.USER_ID_HEADER);
         try {
             Wrapper<String> yamlStringWrapper = new Wrapper<>();
             String url = request.getMethod() + " " + request.getRequestURI();
-            log.debug("Start handle request of {}", url);
+            log.debug(START_HANDLE_REQUEST_OF, url);
             Wrapper<Response> responseWrapper = doUploadTypeValidations(request, userId, file);
             if (responseWrapper.isEmpty()) {
                 fillZipContents(yamlStringWrapper, file);
@@ -263,30 +270,31 @@
             }
             return responseWrapper.getInnerElement();
         } catch (Exception e) {
-            log.debug("create {} failed with exception:", elementTypeName, e);
+            log.debug(CREATE_FAILED_WITH_EXCEPTION, elementTypeName, e);
             BeEcompErrorManager.getInstance().logBeRestApiGeneralError(CREATE + elementTypeName);
             return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
         }
     }
-    
-    private Response uploadElementTypeServletLogic(final ConsumerThreeParam<Wrapper<Response>, String, String> createElementsMethod,
-            final File file, final HttpServletRequest request, final String creator, final String elementTypeName, final String modelName) {
+
+    private Response uploadElementTypeServletLogic(final ConsumerFourParam<Wrapper<Response>, String, String, Boolean> createElementsMethod,
+                                                   final File file, final HttpServletRequest request, final String creator,
+                                                   final String elementTypeName, final String modelName, final boolean includeToModelDefaultImports) {
         init();
         final String userId = initHeaderParam(creator, request, Constants.USER_ID_HEADER);
         try {
             final Wrapper<String> yamlStringWrapper = new Wrapper<>();
             final String url = request.getMethod() + " " + request.getRequestURI();
-            log.debug("Start handle request of {}", url);
+            log.debug(START_HANDLE_REQUEST_OF, url);
             final Wrapper<Response> responseWrapper = doUploadTypeValidations(request, userId, file);
             if (responseWrapper.isEmpty()) {
                 fillZipContents(yamlStringWrapper, file);
             }
             if (responseWrapper.isEmpty()) {
-                createElementsMethod.accept(responseWrapper, yamlStringWrapper.getInnerElement(), modelName);
+                createElementsMethod.accept(responseWrapper, yamlStringWrapper.getInnerElement(), modelName, includeToModelDefaultImports);
             }
             return responseWrapper.getInnerElement();
         } catch (final Exception e) {
-            log.debug("create {} failed with exception:", elementTypeName, e);
+            log.debug(CREATE_FAILED_WITH_EXCEPTION, elementTypeName, e);
             BeEcompErrorManager.getInstance().logBeRestApiGeneralError(CREATE + elementTypeName);
             return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
         }
@@ -296,7 +304,7 @@
         Wrapper<Response> responseWrapper = new Wrapper<>();
         Wrapper<User> userWrapper = new Wrapper<>();
         String url = request.getMethod() + " " + request.getRequestURI();
-        log.debug("Start handle request of {}", url);
+        log.debug(START_HANDLE_REQUEST_OF, url);
         validateUserExist(responseWrapper, userWrapper, userId);
         if (responseWrapper.isEmpty()) {
             validateUserRole(responseWrapper, userWrapper.getInnerElement());
@@ -307,9 +315,9 @@
         return responseWrapper;
     }
 
-    private Response uploadTypesWithMetaData(ConsumerThreeParam<Wrapper<Response>, ToscaTypeImportData, String> createElementsMethod,
+    private Response uploadTypesWithMetaData(ConsumerFourParam<Wrapper<Response>, ToscaTypeImportData, String, Boolean> createElementsMethod,
                                              Map<String, ToscaTypeMetadata> typesMetaData, File file, final HttpServletRequest request,
-                                             String creator, String elementTypeName, String modelName) {
+                                             String creator, String elementTypeName, String modelName, final boolean includeToModelDefaultImports) {
         init();
         String userId = initHeaderParam(creator, request, Constants.USER_ID_HEADER);
         Wrapper<String> yamlStringWrapper = new Wrapper<>();
@@ -320,11 +328,11 @@
             }
             if (responseWrapper.isEmpty()) {
                 ToscaTypeImportData toscaTypeImportData = new ToscaTypeImportData(yamlStringWrapper.getInnerElement(), typesMetaData);
-                createElementsMethod.accept(responseWrapper, toscaTypeImportData, modelName);
+                createElementsMethod.accept(responseWrapper, toscaTypeImportData, modelName, includeToModelDefaultImports);
             }
             return responseWrapper.getInnerElement();
         } catch (Exception e) {
-            log.debug("create {} failed with exception:", elementTypeName, e);
+            log.debug(CREATE_FAILED_WITH_EXCEPTION, elementTypeName, e);
             BeEcompErrorManager.getInstance().logBeRestApiGeneralError(CREATE + elementTypeName);
             return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR));
         }
@@ -349,55 +357,54 @@
     }
 
     // data types
-    private void createDataTypes(Wrapper<Response> responseWrapper, String dataTypesYml, final String modelName) {
-        final Supplier<Either<List<ImmutablePair<DataTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () -> dataTypeImportManager
-            .createDataTypes(dataTypesYml, modelName);
+    private void createDataTypes(Wrapper<Response> responseWrapper, String dataTypesYml, final String modelName, final boolean includeToModelDefaultImports) {
+        final Supplier<Either<List<ImmutablePair<DataTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () ->
+            dataTypeImportManager.createDataTypes(dataTypesYml, modelName, includeToModelDefaultImports);
         buildStatusForElementTypeCreate(responseWrapper, generateElementTypeFromYml, ActionStatus.DATA_TYPE_ALREADY_EXIST,
             NodeTypeEnum.DataType.name());
     }
 
     // group types
-    private void createGroupTypes(Wrapper<Response> responseWrapper, ToscaTypeImportData toscaTypeImportData, String modelName) {
-        final Supplier<Either<List<ImmutablePair<GroupTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () -> groupTypeImportManager
-            .createGroupTypes(toscaTypeImportData, modelName);
+    private void createGroupTypes(Wrapper<Response> responseWrapper, ToscaTypeImportData toscaTypeImportData, String modelName,
+                                  final boolean includeToModelDefaultImports) {
+        final Supplier<Either<List<ImmutablePair<GroupTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () ->
+            groupTypeImportManager.createGroupTypes(toscaTypeImportData, modelName, includeToModelDefaultImports);
         buildStatusForElementTypeCreate(responseWrapper, generateElementTypeFromYml, ActionStatus.GROUP_TYPE_ALREADY_EXIST,
             NodeTypeEnum.GroupType.name());
     }
 
     // policy types
-    private void createPolicyTypes(Wrapper<Response> responseWrapper, ToscaTypeImportData toscaTypeImportData, String modelName) {
-        final Supplier<Either<List<ImmutablePair<PolicyTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () -> policyTypeImportManager
-            .createPolicyTypes(toscaTypeImportData, modelName);
+    private void createPolicyTypes(Wrapper<Response> responseWrapper, ToscaTypeImportData toscaTypeImportData, String modelName,
+                                   final boolean includeToModelDefaultImports) {
+        final Supplier<Either<List<ImmutablePair<PolicyTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () ->
+            policyTypeImportManager.createPolicyTypes(toscaTypeImportData, modelName, includeToModelDefaultImports);
         buildStatusForElementTypeCreate(responseWrapper, generateElementTypeFromYml, ActionStatus.POLICY_TYPE_ALREADY_EXIST,
             NodeTypeEnum.PolicyType.name());
     }
 
     // data types
-    private <ElementTypeDefinition> void buildStatusForElementTypeCreate(Wrapper<Response> responseWrapper,
-                                                                         Supplier<Either<List<ImmutablePair<ElementTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml,
-                                                                         ActionStatus alreadyExistStatus, String elementTypeName) {
-        Either<List<ImmutablePair<ElementTypeDefinition, Boolean>>, ResponseFormat> eitherResult = generateElementTypeFromYml.get();
+    private <T extends ToscaDataDefinition> void buildStatusForElementTypeCreate(Wrapper<Response> responseWrapper,
+                                                                                 Supplier<Either<List<ImmutablePair<T, Boolean>>, ResponseFormat>> generateElementTypeFromYml,
+                                                                                 ActionStatus alreadyExistStatus, String elementTypeName) {
+        Either<List<ImmutablePair<T, Boolean>>, ResponseFormat> eitherResult = generateElementTypeFromYml.get();
         if (eitherResult.isRight()) {
             Response response = buildErrorResponse(eitherResult.right().value());
             responseWrapper.setInnerElement(response);
         } else {
             Object representation;
             try {
-                List<ImmutablePair<ElementTypeDefinition, Boolean>> list = eitherResult.left().value();
+                List<ImmutablePair<T, Boolean>> list = eitherResult.left().value();
                 ActionStatus status = ActionStatus.OK;
                 if (list != null) {
                     // Group result by the right value - true or false.
-
-                    // I.e., get the number of data types which are new and
-
-                    // which are old.
-                    Map<Boolean, List<ImmutablePair<ElementTypeDefinition, Boolean>>> collect = list.stream()
-                        .collect(Collectors.groupingBy(ImmutablePair<ElementTypeDefinition, Boolean>::getRight));
+                    // I.e., get the number of data types which are new and which are old.
+                    Map<Boolean, List<ImmutablePair<T, Boolean>>> collect = list.stream()
+                        .collect(Collectors.groupingBy(ImmutablePair<T, Boolean>::getRight));
                     if (collect != null) {
                         Set<Boolean> keySet = collect.keySet();
                         if (keySet.size() == 1) {
                             Boolean isNew = keySet.iterator().next();
-                            if (isNew) {
+                            if (Boolean.TRUE.equals(isNew)) {
                                 // all data types created at the first time
                                 status = ActionStatus.CREATED;
                             } else {
@@ -420,9 +427,12 @@
     }
 
     // relationship types
-    private void createRelationshipTypes(final Wrapper<Response> responseWrapper, final String relationshipTypesYml, final String modelName) {
+    private void createRelationshipTypes(final Wrapper<Response> responseWrapper,
+                                         final String relationshipTypesYml,
+                                         final String modelName,
+                                         final boolean includeToModelDefaultImports) {
         final Supplier<Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () -> relationshipTypeImportManager
-            .createRelationshipTypes(relationshipTypesYml, modelName);
+            .createRelationshipTypes(relationshipTypesYml, modelName, includeToModelDefaultImports);
         buildStatusForElementTypeCreate(responseWrapper, generateElementTypeFromYml, ActionStatus.RELATIONSHIP_TYPE_ALREADY_EXIST,
             NodeTypeEnum.RelationshipType.name());
     }
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java
index f8b1800..a4d02e1 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManagerTest.java
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +20,19 @@
 
 package org.openecomp.sdc.be.components.impl;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
 import fj.data.Either;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.junit.Before;
@@ -41,37 +53,26 @@
 import org.openecomp.sdc.common.util.CapabilityTypeNameEnum;
 import org.openecomp.sdc.exception.ResponseFormat;
 
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 public class CapabilityTypeImportManagerTest {
+
     private static final CapabilityTypeOperation capabilityTypeOperation = mock(CapabilityTypeOperation.class);
     private static final ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
     private static final JanusGraphGenericDao JANUS_GRAPH_GENERIC_DAO = mock(JanusGraphGenericDao.class);
     private static final PropertyOperation propertyOperation = mock(PropertyOperation.class);
-    private CommonImportManager commonImportManager = new CommonImportManager(componentsUtils, propertyOperation);
-    private ModelOperation modelOperation = mock(ModelOperation.class);
+    private static final ModelOperation modelOperation = mock(ModelOperation.class);
+    private CommonImportManager commonImportManager = new CommonImportManager(componentsUtils, propertyOperation, modelOperation);
     private CapabilityTypeImportManager manager = new CapabilityTypeImportManager(capabilityTypeOperation, commonImportManager, modelOperation);
 
     @BeforeClass
     public static void beforeClass() {
-        when(capabilityTypeOperation.addCapabilityType(Mockito.any(CapabilityTypeDefinition.class))).thenAnswer(new Answer<Either<CapabilityTypeDefinition, StorageOperationStatus>>() {
-            public Either<CapabilityTypeDefinition, StorageOperationStatus> answer(InvocationOnMock invocation) {
-                Object[] args = invocation.getArguments();
-                return Either.left((CapabilityTypeDefinition) args[0]);
-            }
+        when(capabilityTypeOperation.addCapabilityType(Mockito.any(CapabilityTypeDefinition.class))).thenAnswer(
+            new Answer<Either<CapabilityTypeDefinition, StorageOperationStatus>>() {
+                public Either<CapabilityTypeDefinition, StorageOperationStatus> answer(InvocationOnMock invocation) {
+                    Object[] args = invocation.getArguments();
+                    return Either.left((CapabilityTypeDefinition) args[0]);
+                }
 
-        });
+            });
 
         when(propertyOperation.getJanusGraphGenericDao()).thenReturn(JANUS_GRAPH_GENERIC_DAO);
         when(capabilityTypeOperation.getCapabilityType(Mockito.anyString())).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
@@ -86,7 +87,8 @@
     public void testCreateCapabilityTypes() throws IOException {
         String ymlContent = getCapabilityTypesYml();
         when(modelOperation.findModelByName("testModel")).thenReturn(Optional.of(new Model("testModel")));
-        Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> createCapabilityTypes = manager.createCapabilityTypes(ymlContent, "testModel");
+        Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> createCapabilityTypes = manager.createCapabilityTypes(
+            ymlContent, "testModel", false);
         assertTrue(createCapabilityTypes.isLeft());
 
         List<ImmutablePair<CapabilityTypeDefinition, Boolean>> capabilityTypesList = createCapabilityTypes.left().value();
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java
index 0527f37..b360a94 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CommonImportManagerTest.java
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +20,17 @@
 
 package org.openecomp.sdc.be.components.impl;
 
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
 import fj.data.Either;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.BiFunction;
+import java.util.function.Function;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.junit.Before;
 import org.junit.Test;
@@ -34,31 +44,24 @@
 import org.openecomp.sdc.be.impl.ComponentsUtils;
 import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
+import org.openecomp.sdc.be.model.operations.impl.ModelOperation;
 import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
 import org.openecomp.sdc.exception.ResponseFormat;
 import org.openecomp.sdc.exception.ServiceException;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
 @RunWith(MockitoJUnitRunner.class)
 public class CommonImportManagerTest {
+
     private CommonImportManager commonImportManager;
     @Mock
     private ComponentsUtils componentsUtils;
     @Mock
-    PropertyOperation propertyOperation;
+    private PropertyOperation propertyOperation;
+    @Mock
+    private ModelOperation modelOperation;
     @Mock
     private JanusGraphGenericDao janusGraphGenericDao;
-    
+
     @Mock
     private Function<Object, Either<ActionStatus, ResponseFormat>> validator;
     @Mock
@@ -69,59 +72,60 @@
     private Function<Object, Either<Object, StorageOperationStatus>> elementAdder;
     @Mock
     private BiFunction<Object, Object, Either<Object, StorageOperationStatus>> elementUpgrader;
-    
+
     @Before
     public void startUp() {
-        commonImportManager = new CommonImportManager(componentsUtils, propertyOperation);
-        
+        commonImportManager = new CommonImportManager(componentsUtils, propertyOperation, modelOperation);
+
         when(propertyOperation.getJanusGraphGenericDao()).thenReturn(janusGraphGenericDao);
     }
-    
+
     @Test
     public void testCreateElementTypesByDao_validationFailed() {
         Object type1 = new Object();
         List<Object> elementTypesToCreate = Arrays.asList(type1);
-        
-        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability"); 
+
+        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability");
         when(elementInfoGetter.apply(type1)).thenReturn(elementInfo);
-        
+
         ResponseFormat responseFormat = new ResponseFormat();
         responseFormat.setServiceException(new ServiceException());
         when(validator.apply(type1)).thenReturn(Either.right(responseFormat));
 
+        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate,
+            validator, elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
 
-        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
-        
         verify(elementAdder, never()).apply(Mockito.any());
         verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
         verify(janusGraphGenericDao).rollback();
         assertThat(result.isRight()).isTrue();
     }
-    
+
     @Test(expected = RuntimeException.class)
     public void testCreateElementTypesByDao_RuntTimeExceptionInValidation() {
         Object type1 = new Object();
         List<Object> elementTypesToCreate = Arrays.asList(type1);
-        
-        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability"); 
+
+        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability");
         when(elementInfoGetter.apply(type1)).thenReturn(elementInfo);
         when(validator.apply(type1)).thenThrow(new RuntimeException("Test Exception"));
-        
-        commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
-        
+
+        commonImportManager.createElementTypesByDao(elementTypesToCreate, validator, elementInfoGetter, elementFetcher, elementAdder,
+            elementUpgrader);
+
         verify(elementAdder, never()).apply(Mockito.any());
         verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
         verify(janusGraphGenericDao).rollback();
     }
-    
+
     @Test
     public void testCreateElementTypesByDao_capabilityTypeFetcherFailed() {
         CapabilityTypeDefinition type1 = new CapabilityTypeDefinition();
         List<Object> elementTypesToCreate = Arrays.asList(type1);
-        
-        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability"); 
+
+        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability");
         when(elementInfoGetter.apply(type1)).thenReturn(elementInfo);
-        
+
         when(validator.apply(type1)).thenReturn(Either.left(ActionStatus.OK));
         when(elementFetcher.apply("TestCapability")).thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
         ResponseFormat responseFormat = new ResponseFormat();
@@ -129,34 +133,34 @@
         when(componentsUtils.convertFromStorageResponseForCapabilityType(Mockito.any())).thenCallRealMethod();
         when(componentsUtils.getResponseFormatByCapabilityType(ActionStatus.INVALID_CONTENT, type1)).thenReturn(responseFormat);
 
+        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate,
+            validator, elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
 
-        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
-        
         verify(elementAdder, never()).apply(Mockito.any());
         verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
         verify(janusGraphGenericDao).rollback();
         assertThat(result.isRight()).isTrue();
     }
-    
+
     @Test
     public void testCreateElementTypesByDao_capabilityTypeNotFound_AddFailed() {
         CapabilityTypeDefinition type1 = new CapabilityTypeDefinition();
         List<Object> elementTypesToCreate = Arrays.asList(type1);
-        
-        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability"); 
+
+        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability");
         when(elementInfoGetter.apply(type1)).thenReturn(elementInfo);
-        
+
         when(validator.apply(type1)).thenReturn(Either.left(ActionStatus.OK));
         when(elementFetcher.apply("TestCapability")).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
         when(elementAdder.apply(type1)).thenReturn(Either.right(StorageOperationStatus.SCHEMA_VIOLATION));
-        
+
         ResponseFormat responseFormat = new ResponseFormat();
         responseFormat.setServiceException(new ServiceException());
         when(componentsUtils.convertFromStorageResponseForCapabilityType(Mockito.any())).thenCallRealMethod();
         when(componentsUtils.getResponseFormatByCapabilityType(ActionStatus.CAPABILITY_TYPE_ALREADY_EXIST, type1)).thenReturn(responseFormat);
 
-
-        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
+        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate,
+            validator, elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
 
         verify(elementAdder).apply(type1);
         verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
@@ -164,99 +168,101 @@
         assertThat(result.isRight()).isTrue();
     }
 
-    
+
     @Test
     public void testCreateElementTypesByDao_capabilityTypeNotFound_AddSucceeded() {
         CapabilityTypeDefinition type1 = new CapabilityTypeDefinition();
         List<Object> elementTypesToCreate = Arrays.asList(type1);
-        
-        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability"); 
+
+        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability");
         when(elementInfoGetter.apply(type1)).thenReturn(elementInfo);
-        
+
         when(validator.apply(type1)).thenReturn(Either.left(ActionStatus.OK));
         when(elementFetcher.apply("TestCapability")).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND));
         when(elementAdder.apply(type1)).thenReturn(Either.left(type1));
-        
-        
-        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
+
+        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate,
+            validator, elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
 
         verify(elementAdder).apply(type1);
         verify(elementUpgrader, never()).apply(Mockito.any(), Mockito.any());
         verify(janusGraphGenericDao).commit();
-        
+
         assertEquals(type1, result.left().value().get(0).getLeft());
         assertEquals(true, result.left().value().get(0).getRight());
     }
-    
+
     @Test
     public void testCreateElementTypesByDao_capabilityTypeFound_UpgradeFailed() {
         CapabilityTypeDefinition type1 = new CapabilityTypeDefinition();
         CapabilityTypeDefinition type1_1 = new CapabilityTypeDefinition();
         List<Object> elementTypesToCreate = Arrays.asList(type1_1);
-        
-        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability"); 
+
+        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability");
         when(elementInfoGetter.apply(type1_1)).thenReturn(elementInfo);
-        
+
         when(validator.apply(type1_1)).thenReturn(Either.left(ActionStatus.OK));
         when(elementFetcher.apply("TestCapability")).thenReturn(Either.left(type1));
         when(elementUpgrader.apply(type1_1, type1)).thenReturn(Either.right(StorageOperationStatus.SCHEMA_VIOLATION));
-        
+
         ResponseFormat responseFormat = new ResponseFormat();
         responseFormat.setServiceException(new ServiceException());
         when(componentsUtils.convertFromStorageResponseForCapabilityType(Mockito.any())).thenCallRealMethod();
         when(componentsUtils.getResponseFormatByCapabilityType(ActionStatus.CAPABILITY_TYPE_ALREADY_EXIST, type1_1)).thenReturn(responseFormat);
 
-
-        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
+        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate,
+            validator, elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
 
         verify(elementAdder, never()).apply(Mockito.any());
         verify(elementUpgrader).apply(type1_1, type1);
         verify(janusGraphGenericDao).rollback();
         assertThat(result.isRight()).isTrue();
     }
-    
+
     @Test
     public void testCreateElementTypesByDao_capabilityTypeFound_UpgradeSucceeded() {
         CapabilityTypeDefinition type1 = new CapabilityTypeDefinition();
         CapabilityTypeDefinition type1_1 = new CapabilityTypeDefinition();
         List<Object> elementTypesToCreate = Arrays.asList(type1_1);
-        
-        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability"); 
+
+        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability");
         when(elementInfoGetter.apply(type1_1)).thenReturn(elementInfo);
-        
+
         when(validator.apply(type1_1)).thenReturn(Either.left(ActionStatus.OK));
         when(elementFetcher.apply("TestCapability")).thenReturn(Either.left(type1));
         when(elementUpgrader.apply(type1_1, type1)).thenReturn(Either.left(type1_1));
-        
-        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
+
+        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate,
+            validator, elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
 
         verify(elementAdder, never()).apply(Mockito.any());
         verify(elementUpgrader).apply(type1_1, type1);
         verify(janusGraphGenericDao).commit();
-        
+
         assertEquals(type1_1, result.left().value().get(0).getLeft());
         assertEquals(true, result.left().value().get(0).getRight());
     }
-    
+
     @Test
     public void testCreateElementTypesByDao_capabilityTypeFound_UpgradeAlreadyExists() {
         CapabilityTypeDefinition type1 = new CapabilityTypeDefinition();
         CapabilityTypeDefinition type1_1 = new CapabilityTypeDefinition();
         List<Object> elementTypesToCreate = Arrays.asList(type1_1);
-        
-        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability"); 
+
+        ImmutablePair<ElementTypeEnum, String> elementInfo = new ImmutablePair<>(ElementTypeEnum.CAPABILITY_TYPE, "TestCapability");
         when(elementInfoGetter.apply(type1_1)).thenReturn(elementInfo);
-        
+
         when(validator.apply(type1_1)).thenReturn(Either.left(ActionStatus.OK));
         when(elementFetcher.apply("TestCapability")).thenReturn(Either.left(type1));
         when(elementUpgrader.apply(type1_1, type1)).thenReturn(Either.right(StorageOperationStatus.OK));
-        
-        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate , validator , elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
+
+        Either<List<ImmutablePair<Object, Boolean>>, ResponseFormat> result = commonImportManager.createElementTypesByDao(elementTypesToCreate,
+            validator, elementInfoGetter, elementFetcher, elementAdder, elementUpgrader);
 
         verify(elementAdder, never()).apply(Mockito.any());
         verify(elementUpgrader).apply(type1_1, type1);
         verify(janusGraphGenericDao).commit();
-        
+
         assertEquals(type1_1, result.left().value().get(0).getLeft());
         assertEquals(false, result.left().value().get(0).getRight());
     }
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManagerTest.java
index a6ee23b..c288fa8 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManagerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManagerTest.java
@@ -50,7 +50,7 @@
     public void shouldInvokeCreateElementTypes() {
         GroupTypeImportManager groupTypeImportManager = new GroupTypeImportManager(groupTypeOperation, componentsUtils,
             toscaOperationFacade, commonImportManager, modelOperation);
-        groupTypeImportManager.createGroupTypes(data, null);
+        groupTypeImportManager.createGroupTypes(data, null, false);
         Mockito.verify(commonImportManager).createElementTypes(Mockito.any(ToscaTypeImportData.class), Mockito.any(), Mockito.any(), Mockito.any());
     }
 }
\ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java
index 0595a4c..9aa68d8 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManagerTest.java
@@ -20,7 +20,21 @@
 
 package org.openecomp.sdc.be.components.impl;
 
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
 import fj.data.Either;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -41,21 +55,6 @@
 import org.openecomp.sdc.be.model.operations.impl.ModelOperation;
 import org.openecomp.sdc.exception.ResponseFormat;
 
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsInAnyOrder;
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
 public class InterfaceLifecycleTypeImportManagerTest {
 
     @InjectMocks
@@ -67,13 +66,14 @@
 
     @BeforeClass
     public static void beforeClass() throws IOException {
-        when(interfaceLifecycleOperation.createInterfaceType(Mockito.any(InterfaceDefinition.class))).thenAnswer(new Answer<Either<InterfaceDefinition, StorageOperationStatus>>() {
-            public Either<InterfaceDefinition, StorageOperationStatus> answer(InvocationOnMock invocation) {
-                Object[] args = invocation.getArguments();
-                return Either.left((InterfaceDefinition) args[0]);
-            }
+        when(interfaceLifecycleOperation.createInterfaceType(Mockito.any(InterfaceDefinition.class))).thenAnswer(
+            new Answer<Either<InterfaceDefinition, StorageOperationStatus>>() {
+                public Either<InterfaceDefinition, StorageOperationStatus> answer(InvocationOnMock invocation) {
+                    Object[] args = invocation.getArguments();
+                    return Either.left((InterfaceDefinition) args[0]);
+                }
 
-        });
+            });
         when(commonImportManager.createElementTypesFromYml(Mockito.anyString(), Mockito.any())).thenCallRealMethod();
         when(commonImportManager.createElementTypesFromToscaJsonMap(Mockito.any(), Mockito.any())).thenCallRealMethod();
     }
@@ -88,7 +88,7 @@
         final String ymlContent = getYmlContent();
         when(modelOperation.findModelByName("test")).thenReturn(Optional.of(new Model("test")));
         final Either<List<InterfaceDefinition>, ResponseFormat> createCapabilityTypes =
-            importManager.createLifecycleTypes(ymlContent, "test");
+            importManager.createLifecycleTypes(ymlContent, "test", false);
         assertTrue(createCapabilityTypes.isLeft());
         final List<InterfaceDefinition> interfaceDefinitionList = createCapabilityTypes.left().value();
         assertThat("Interface definitions should not be empty", interfaceDefinitionList, is(not(empty())));
@@ -98,10 +98,10 @@
         final String standardInterfaceType = "tosca.interfaces.node.lifecycle.Standard";
         final String nslcmInterfaceType = "tosca.interfaces.nfv.Nslcm";
         final Optional<InterfaceDefinition> standardInterfaceOpt = interfaceDefinitionList.stream().filter(
-            interfaceDefinition -> standardInterfaceType.equals(interfaceDefinition.getType()))
+                interfaceDefinition -> standardInterfaceType.equals(interfaceDefinition.getType()))
             .findFirst();
         final Optional<InterfaceDefinition> nslcmInterfaceOpt = interfaceDefinitionList.stream().filter(
-            interfaceDefinition -> nslcmInterfaceType.equals(interfaceDefinition.getType()))
+                interfaceDefinition -> nslcmInterfaceType.equals(interfaceDefinition.getType()))
             .findFirst();
         assertThat("", standardInterfaceOpt.isPresent(), is(true));
         assertThat("", nslcmInterfaceOpt.isPresent(), is(true));
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogicTest.java
index 08d0787..5e9d4e7 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogicTest.java
@@ -46,8 +46,8 @@
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.exception.BusinessException;
 import org.openecomp.sdc.be.model.Model;
-import org.openecomp.sdc.be.model.jsonjanusgraph.operations.exception.OperationException;
 import org.openecomp.sdc.be.model.jsonjanusgraph.operations.exception.ModelOperationExceptionSupplier;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.exception.OperationException;
 import org.openecomp.sdc.be.model.operations.impl.ModelOperation;
 import org.openecomp.sdc.common.zip.ZipUtils;
 import org.openecomp.sdc.common.zip.exception.ZipException;
@@ -80,7 +80,7 @@
         assertThat(result).isNotNull();
         assertThat(result.getName()).isEqualTo(model.getName());
     }
-    
+
     @Test
     void createModelWithDataTypesTest() {
         final String dataTypes = "dummyString";
@@ -88,8 +88,8 @@
         final Model result = modelBusinessLogic.createModel(model, dataTypes);
         assertThat(result).isNotNull();
         assertThat(result.getName()).isEqualTo(model.getName());
-        
-        verify(dataTypeImportManager).createDataTypes(dataTypes, model.getName());
+
+        verify(dataTypeImportManager).createDataTypes(dataTypes, model.getName(), false);
     }
 
     @Test
@@ -220,4 +220,4 @@
         final List<Model> actualModelList = modelBusinessLogic.listModels();
         assertTrue(actualModelList.isEmpty(), "The model list should be empty");
     }
-}
\ No newline at end of file
+}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManagerTest.java
index 06be58d..5a8a704 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManagerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManagerTest.java
@@ -44,7 +44,7 @@
     public void shouldInvokeCreateElementTypes() {
         RelationshipTypeImportManager relationshipTypeImportManager =
             new RelationshipTypeImportManager(relationshipTypeOperation, commonImportManager, componentsUtils, modelOperation);
-        relationshipTypeImportManager.createRelationshipTypes("anyYaml", "anyModel");
+        relationshipTypeImportManager.createRelationshipTypes("anyYaml", "anyModel", false);
         Mockito.verify(commonImportManager).createElementTypes((String) Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
 
     }
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java
index c948910..72af772 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadEndpointTest.java
@@ -67,6 +67,7 @@
 import org.openecomp.sdc.be.model.operations.StorageException;
 import org.openecomp.sdc.be.model.operations.impl.AnnotationTypeOperations;
 import org.openecomp.sdc.be.model.operations.impl.CommonTypeOperations;
+import org.openecomp.sdc.be.model.operations.impl.ModelOperation;
 import org.openecomp.sdc.be.model.operations.impl.OperationUtils;
 import org.openecomp.sdc.be.model.operations.impl.PropertyOperation;
 import org.openecomp.sdc.be.resources.data.AnnotationTypeData;
@@ -84,40 +85,14 @@
     private static PropertyOperation propertyOperation;
     private static ComponentsUtils componentUtils;
     private static OperationUtils operationUtils;
-
-    @org.springframework.context.annotation.Configuration
-    @Import(BaseTestConfig.class)
-    static class TypesUploadTestConfig {
-
-        @Bean
-        TypesUploadEndpoint typesUploadEndpoint() {
-            UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
-            ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
-            return new TypesUploadEndpoint(userBusinessLogic, componentsUtils, commonImportManager(),
-                annotationTypeOperations(), accessValidations);
-        }
-
-        @Bean
-        CommonImportManager commonImportManager() {
-            return new CommonImportManager(componentUtils, propertyOperation);
-        }
-
-        @Bean
-        AnnotationTypeOperations annotationTypeOperations() {
-            return new AnnotationTypeOperations(commonTypeOperations());
-        }
-
-        @Bean
-        CommonTypeOperations commonTypeOperations() {
-            return new CommonTypeOperations(janusGraphGenericDao, propertyOperation, operationUtils);
-        }
-    }
+    private static ModelOperation modelOperation;
 
     @BeforeAll
     public static void initClass() {
         janusGraphGenericDao = mock(HealingJanusGraphGenericDao.class);
         accessValidations = mock(AccessValidations.class);
         propertyOperation = mock(PropertyOperation.class);
+        modelOperation = mock(ModelOperation.class);
         componentUtils = Mockito.mock(ComponentsUtils.class);
         operationUtils = Mockito.mock(OperationUtils.class);
     }
@@ -258,4 +233,32 @@
         typeActionResults.add(new ImmutablePair(dummyDefition, null));
         assertThat(TypesUploadEndpoint.getHttpStatus(typeActionResults).value()).isEqualTo(HttpStatus.BAD_REQUEST_400);
     }
+
+    @org.springframework.context.annotation.Configuration
+    @Import(BaseTestConfig.class)
+    static class TypesUploadTestConfig {
+
+        @Bean
+        TypesUploadEndpoint typesUploadEndpoint() {
+            UserBusinessLogic userBusinessLogic = mock(UserBusinessLogic.class);
+            ComponentsUtils componentsUtils = mock(ComponentsUtils.class);
+            return new TypesUploadEndpoint(userBusinessLogic, componentsUtils, commonImportManager(),
+                annotationTypeOperations(), accessValidations);
+        }
+
+        @Bean
+        CommonImportManager commonImportManager() {
+            return new CommonImportManager(componentUtils, propertyOperation, modelOperation);
+        }
+
+        @Bean
+        AnnotationTypeOperations annotationTypeOperations() {
+            return new AnnotationTypeOperations(commonTypeOperations());
+        }
+
+        @Bean
+        CommonTypeOperations commonTypeOperations() {
+            return new CommonTypeOperations(janusGraphGenericDao, propertyOperation, operationUtils);
+        }
+    }
 }
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java
index 395bee3..0819119 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/TypesUploadServletTest.java
@@ -37,7 +37,6 @@
 import org.eclipse.jetty.http.HttpStatus;
 import org.glassfish.hk2.utilities.binding.AbstractBinder;
 import org.glassfish.jersey.client.ClientConfig;
-import org.glassfish.jersey.media.multipart.FormDataBodyPart;
 import org.glassfish.jersey.media.multipart.FormDataMultiPart;
 import org.glassfish.jersey.media.multipart.MultiPart;
 import org.glassfish.jersey.media.multipart.MultiPartFeature;
@@ -130,7 +129,7 @@
     @Test
     void creatingCapabilityTypeSuccessTest() {
         final Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> either = Either.left(emptyList());
-        when(importManager.createCapabilityTypes(Mockito.anyString(), Mockito.isNull())).thenReturn(either);
+        when(importManager.createCapabilityTypes(Mockito.anyString(), Mockito.isNull(), Mockito.anyBoolean())).thenReturn(either);
         final FileDataBodyPart filePart = new FileDataBodyPart("capabilityTypeZip", new File("src/test/resources/types/capabilityTypes.zip"));
         MultiPart multipartEntity = new FormDataMultiPart();
         multipartEntity.bodyPart(filePart);
@@ -140,11 +139,11 @@
 
         assertEquals(HttpStatus.CREATED_201, response.getStatus());
     }
-    
+
     @Test
     void creatingCapabilityTypeWithModelSuccessTest() {
         final Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> either = Either.left(emptyList());
-        when(importManager.createCapabilityTypes(Mockito.anyString(), Mockito.eq("testModel"))).thenReturn(either);
+        when(importManager.createCapabilityTypes(Mockito.anyString(), Mockito.eq("testModel"), Mockito.anyBoolean())).thenReturn(either);
         final FileDataBodyPart filePart = new FileDataBodyPart("capabilityTypeZip", new File("src/test/resources/types/capabilityTypes.zip"));
         FormDataMultiPart multipartEntity = new FormDataMultiPart();
         multipartEntity.bodyPart(filePart);
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java
index a8b1ec6..5d1501c 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java
@@ -99,6 +99,12 @@
         );
     }
 
+    public void importOnly(final String modelId, final List<ToscaImportByModel> toscaImportByModelList) {
+        toscaImportByModelList.stream()
+            .filter(toscaImportByModel -> modelId.equals(toscaImportByModel.getModelId()))
+            .forEach(toscaImportByModelMapper::save);
+    }
+
     public List<ToscaImportByModel> findAllByModel(final String modelId) {
         return toscaImportByModelAccessor.findAllByModel(modelId).all();
     }
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
index 900c340..ce1f574 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
@@ -19,18 +19,21 @@
 package org.openecomp.sdc.be.model.operations.impl;
 
 import fj.data.Either;
-
 import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.EnumMap;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
+import java.util.Set;
 import java.util.stream.Collectors;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.onap.sdc.tosca.services.YamlUtil;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.dao.cassandra.ToscaModelImportCassandraDao;
 import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
@@ -45,20 +48,22 @@
 import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
 import org.openecomp.sdc.be.model.Model;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.exception.ModelOperationExceptionSupplier;
 import org.openecomp.sdc.be.model.jsonjanusgraph.operations.exception.OperationException;
 import org.openecomp.sdc.be.model.operations.api.DerivedFromOperation;
 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.openecomp.sdc.be.model.jsonjanusgraph.operations.exception.ModelOperationExceptionSupplier;
 import org.openecomp.sdc.be.resources.data.ModelData;
 import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode;
 import org.openecomp.sdc.common.log.wrappers.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.yaml.snakeyaml.Yaml;
 
 @Component("model-operation")
 public class ModelOperation {
 
     private static final Logger log = Logger.getLogger(ModelOperation.class);
+    private static final String ADDITIONAL_TYPE_DEFINITIONS = "additional_type_definitions.yml";
 
     private final JanusGraphGenericDao janusGraphGenericDao;
     private final JanusGraphDao janusGraphDao;
@@ -104,21 +109,23 @@
             }
         }
     }
-    
+
     private void addDerivedFromRelation(final Model model) {
         final String derivedFrom = model.getDerivedFrom();
         if (derivedFrom == null) {
             return;
         }
         log.debug("Adding derived from relation between model {} to its parent {}",
-                model.getName(), derivedFrom);
+            model.getName(), derivedFrom);
         final Optional<Model> derivedFromModelOptional = this.findModelByName(derivedFrom);
         if (derivedFromModelOptional.isPresent()) {
-            final Either<GraphRelation, StorageOperationStatus> result = derivedFromOperation.addDerivedFromRelation(UniqueIdBuilder.buildModelUid(model.getName()), 
-                    UniqueIdBuilder.buildModelUid(derivedFromModelOptional.get().getName()), NodeTypeEnum.Model);
-            if(result.isRight()) {
+            final Either<GraphRelation, StorageOperationStatus> result = derivedFromOperation.addDerivedFromRelation(
+                UniqueIdBuilder.buildModelUid(model.getName()),
+                UniqueIdBuilder.buildModelUid(derivedFromModelOptional.get().getName()), NodeTypeEnum.Model);
+            if (result.isRight()) {
                 throw new OperationException(ActionStatus.GENERAL_ERROR,
-                    String.format("Failed to create relationship from model % to derived from model %s on JanusGraph with %s error", model, derivedFrom, result.right().value()));
+                    String.format("Failed to create relationship from model %s to derived from model %s on JanusGraph with %s error", model,
+                        derivedFrom, result.right().value()));
             }
         }
     }
@@ -204,8 +211,8 @@
         final String modelName = (String) modelGraphVertex.getMetadataProperty(GraphPropertyEnum.NAME);
 
         final Either<ImmutablePair<ModelData, GraphEdge>, JanusGraphOperationStatus> parentNode =
-                        janusGraphGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Model), UniqueIdBuilder.buildModelUid(modelName),
-                                        GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Model, ModelData.class);
+            janusGraphGenericDao.getChild(UniqueIdBuilder.getKeyByNodeType(NodeTypeEnum.Model), UniqueIdBuilder.buildModelUid(modelName),
+                GraphEdgeLabels.DERIVED_FROM, NodeTypeEnum.Model, ModelData.class);
         log.debug("After retrieving DERIVED_FROM node of {}. status is {}", modelName, parentNode);
         if (parentNode.isRight()) {
             final JanusGraphOperationStatus janusGraphOperationStatus = parentNode.right().value();
@@ -220,6 +227,76 @@
             return new Model((String) modelGraphVertex.getMetadataProperty(GraphPropertyEnum.NAME), parentModel.getName());
         }
     }
+
+    public void addTypesToDefaultImports(final String typesYaml, final String modelName) {
+        final List<ToscaImportByModel> allSchemaImportsByModel = toscaModelImportCassandraDao.findAllByModel(modelName);
+        final Optional<ToscaImportByModel> additionalTypeDefinitionsOptional = allSchemaImportsByModel.stream()
+            .filter(t -> ADDITIONAL_TYPE_DEFINITIONS.equals(t.getFullPath())).findAny();
+        final ToscaImportByModel toscaImportByModelAdditionalTypeDefinitions;
+        final List<ToscaImportByModel> schemaImportsByModel;
+        if (additionalTypeDefinitionsOptional.isPresent()) {
+            toscaImportByModelAdditionalTypeDefinitions = additionalTypeDefinitionsOptional.get();
+            schemaImportsByModel = allSchemaImportsByModel.stream()
+                .filter(toscaImportByModel -> !ADDITIONAL_TYPE_DEFINITIONS.equals(toscaImportByModel.getFullPath()))
+                .collect(Collectors.toList());
+        } else {
+            toscaImportByModelAdditionalTypeDefinitions = new ToscaImportByModel();
+            toscaImportByModelAdditionalTypeDefinitions.setModelId(modelName);
+            toscaImportByModelAdditionalTypeDefinitions.setFullPath(ADDITIONAL_TYPE_DEFINITIONS);
+            toscaImportByModelAdditionalTypeDefinitions.setContent(typesYaml);
+            schemaImportsByModel = new ArrayList<>(allSchemaImportsByModel);
+        }
+
+        final List<ToscaImportByModel> toscaImportByModels = removeExistingDefaultImports(typesYaml, schemaImportsByModel);
+
+        final Map<String, Object> originalContent = (Map<String, Object>) new Yaml().load(toscaImportByModelAdditionalTypeDefinitions.getContent());
+        toscaImportByModelAdditionalTypeDefinitions.setContent(buildAdditionalTypeDefinitionsContent(typesYaml, originalContent).toString());
+        toscaImportByModels.add(toscaImportByModelAdditionalTypeDefinitions);
+
+        toscaModelImportCassandraDao.importOnly(modelName, toscaImportByModels);
+    }
+
+    private List<ToscaImportByModel> removeExistingDefaultImports(final String typesYaml, final List<ToscaImportByModel> schemaImportsByModel) {
+        final List<ToscaImportByModel> toscaImportByModels = new ArrayList<>();
+        schemaImportsByModel.forEach(toscaImportByModel -> {
+            final ToscaImportByModel toscaImportByModelNew = new ToscaImportByModel();
+            toscaImportByModelNew.setModelId(toscaImportByModel.getModelId());
+            toscaImportByModelNew.setFullPath(toscaImportByModel.getFullPath());
+
+            final Map<String, Object> existingImportYamlMap = (Map<String, Object>) new Yaml().load(toscaImportByModel.getContent());
+
+            ((Map<String, Object>) new Yaml().load(typesYaml)).keySet().forEach(existingImportYamlMap::remove);
+
+            final StringBuilder stringBuilder = new StringBuilder();
+            existingImportYamlMap.forEach((key, value) -> {
+                final Map<Object, Object> hashMap = new HashMap<>();
+                hashMap.put(key, value);
+                stringBuilder.append("\n").append(new YamlUtil().objectToYaml(hashMap));
+            });
+
+            toscaImportByModelNew.setContent(stringBuilder.toString());
+            toscaImportByModels.add(toscaImportByModelNew);
+        });
+        return toscaImportByModels;
+    }
+
+    private StringBuilder buildAdditionalTypeDefinitionsContent(final String typesYaml, final Map<String, Object> originalContent) {
+        final var stringBuilder = new StringBuilder();
+
+        final Map<String, Object> typesYamlMap = (Map<String, Object>) new Yaml().load(typesYaml);
+        final Set<String> typeYmlKeySet = typesYamlMap.keySet();
+
+        originalContent.forEach((key, value) -> {
+            final Map<Object, Object> hashMap = new HashMap<>();
+            if (typeYmlKeySet.contains(key)) {
+                hashMap.put(key, typesYamlMap.get(key));
+            } else {
+                hashMap.put(key, value);
+            }
+            final String newContent = new YamlUtil().objectToYaml(hashMap);
+            stringBuilder.append("\n").append(newContent);
+        });
+        return stringBuilder;
+    }
+
 }
-
-
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java
index d03ff05..a0d0b68 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java
@@ -79,7 +79,7 @@
          */
         void accept(T1 t1, T2 t2);
     }
-    
+
     @FunctionalInterface
     public interface ConsumerThreeParam<T1, T2, T3> {
 
@@ -93,6 +93,20 @@
         void accept(T1 t1, T2 t2, T3 t3);
     }
 
+    @FunctionalInterface
+    public interface ConsumerFourParam<T1, T2, T3, T4> {
+
+        /**
+         * Same Accept method, but takes four parameters
+         *
+         * @param t1
+         * @param t2
+         * @param t3
+         * @param t4
+         */
+        void accept(T1 t1, T2 t2, T3 t3, T4 t4);
+    }
+
     /**
      * @param <T1>
      * @param <T2>
