:return: save this OS instance on Ariane server (create or update)

def save(self):
        """
        :return: save this OS instance on Ariane server (create or update)
        """
        LOGGER.debug("OSInstance.save")
        post_payload = {}
        consolidated_osi_id = []
        consolidated_ipa_id = []
        consolidated_nic_id = []
        consolidated_app_id = []
        consolidated_env_id = []
        consolidated_snet_id = []
        consolidated_team_id = []

        if self.id is not None:
            post_payload['osInstanceID'] = self.id

        if self.name is not None:
            post_payload['osInstanceName'] = self.name

        if self.description is not None:
            post_payload['osInstanceDescription'] = self.description

        if self.admin_gate_uri is not None:
            post_payload['osInstanceAdminGateURI'] = self.admin_gate_uri

        if self.embedding_osi_id is not None:
            post_payload['osInstanceEmbeddingOSInstanceID'] = self.embedding_osi_id

        if self.ost_id is not None:
            post_payload['osInstanceOSTypeID'] = self.ost_id

        if self.embedded_osi_ids is not None:
            consolidated_osi_id = copy.deepcopy(self.embedded_osi_ids)
        if self.embedded_osi_2_rm is not None:
            for osi_2_rm in self.embedded_osi_2_rm:
                if osi_2_rm.id is None:
                    osi_2_rm.sync()
                consolidated_osi_id.remove(osi_2_rm.id)
        if self.embedded_osi_2_add is not None:
            for osi_id_2_add in self.embedded_osi_2_add:
                if osi_id_2_add.id is None:
                    osi_id_2_add.save()
                consolidated_osi_id.append(osi_id_2_add.id)
        post_payload['osInstanceEmbeddedOSInstancesID'] = consolidated_osi_id

        if self.ip_address_ids is not None:
            consolidated_ipa_id = copy.deepcopy(self.ip_address_ids)
        if self.ip_address_2_rm is not None:
            for ipa_2_rm in self.ip_address_2_rm:
                if ipa_2_rm.id is None:
                    ipa_2_rm.sync()
                consolidated_ipa_id.remove(ipa_2_rm.id)
        if self.ip_address_2_add is not None:
            for ipa_2_add in self.ip_address_2_add:
                if ipa_2_add.id is None:
                    ipa_2_add.save()
                consolidated_ipa_id.append(ipa_2_add.id)
        post_payload['osInstanceIPAddressesID'] = consolidated_ipa_id

        if self.nic_ids is not None:
            consolidated_nic_id = copy.deepcopy(self.nic_ids)
        if self.nic_2_rm is not None:
            for nic_2_rm in self.nic_2_rm:
                if nic_2_rm.id is None:
                    nic_2_rm.sync()
                consolidated_nic_id.remove(nic_2_rm.id)
        if self.nic_2_add is not None:
            for nic_2_add in self.nic_2_add:
                if nic_2_add.id is None:
                    nic_2_add.save()
                consolidated_nic_id.append(nic_2_add.id)
        post_payload['osInstanceNICsID'] = consolidated_nic_id

        if self.subnet_ids is not None:
            consolidated_snet_id = copy.deepcopy(self.subnet_ids)
        if self.subnets_2_rm is not None:
            for snet_2_rm in self.subnets_2_rm:
                if snet_2_rm.id is None:
                    snet_2_rm.sync()
                consolidated_snet_id.remove(snet_2_rm.id)
        if self.subnets_2_add is not None:
            for snet_2_add in self.subnets_2_add:
                if snet_2_add.id is None:
                    snet_2_add.save()
                consolidated_snet_id.append(snet_2_add.id)
        post_payload['osInstanceSubnetsID'] = consolidated_snet_id

        if self.application_ids is not None:
            consolidated_app_id = copy.deepcopy(self.application_ids)
        if self.application_2_rm is not None:
            for app_2_rm in self.application_2_rm:
                if app_2_rm.id is None:
                    app_2_rm.sync()
                consolidated_app_id.remove(app_2_rm.id)
        if self.application_2_add is not None:
            for app_2_add in self.application_2_add:
                if app_2_add.id is None:
                    app_2_add.save()
                consolidated_app_id.append(app_2_add.id)
        post_payload['osInstanceApplicationsID'] = consolidated_app_id

        if self.environment_ids is not None:
            consolidated_env_id = copy.deepcopy(self.environment_ids)
        if self.environment_2_rm is not None:
            for env_2_rm in self.environment_2_rm:
                if env_2_rm.id is None:
                    env_2_rm.sync()
                consolidated_env_id.remove(env_2_rm.id)
        if self.environment_2_add is not None:
            for env_2_add in self.environment_2_add:
                if env_2_add.id is None:
                    env_2_add.save()
                consolidated_env_id.append(env_2_add.id)
        post_payload['osInstanceEnvironmentsID'] = consolidated_env_id

        if self.team_ids is not None:
            consolidated_team_id = copy.deepcopy(self.team_ids)
        if self.team_2_rm is not None:
            for team_2_rm in self.team_2_rm:
                if team_2_rm.id is None:
                    team_2_rm.sync()
                consolidated_team_id.remove(team_2_rm.id)
        if self.team_2_add is not None:
            for team_2_add in self.team_2_add:
                if team_2_add.id is None:
                    team_2_add.save()
                consolidated_team_id.append(team_2_add.id)
        post_payload['osInstanceTeamsID'] = consolidated_team_id

        args = {'http_operation': 'POST', 'operation_path': '', 'parameters': {'payload': json.dumps(post_payload)}}
        response = OSInstanceService.requester.call(args)
        if response.rc != 0:
            LOGGER.warning(
                'OSInstance.save - Problem while saving OS instance ' + self.name +
                '. Reason: ' + str(response.response_content) + '-' + str(response.error_message) +
                " (" + str(response.rc) + ")"
            )
        else:
            self.id = response.response_content['osInstanceID']
            if self.embedded_osi_2_add is not None:
                for osi_2_add in self.embedded_osi_2_add:
                    osi_2_add.sync()
            if self.embedded_osi_2_rm is not None:
                for osi_2_rm in self.embedded_osi_2_rm:
                    osi_2_rm.sync()
            if self.ip_address_2_add is not None:
                for ipa_2_add in self.ip_address_2_add:
                    ipa_2_add.sync()
            if self.ip_address_2_rm is not None:
                for ipa_2_rm in self.ip_address_2_rm:
                    ipa_2_rm.sync()
            if self.nic_2_add is not None:
                for nic_2_add in self.nic_2_add:
                    nic_2_add.sync()
            if self.nic_2_rm is not None:
                for nic_2_rm in self.nic_2_rm:
                    nic_2_rm.sync()
            if self.subnets_2_add is not None:
                for snet_2_add in self.subnets_2_add:
                    snet_2_add.sync()
            if self.subnets_2_rm is not None:
                for snet_2_rm in self.subnets_2_rm:
                    snet_2_rm.sync()
            if self.application_2_add is not None:
                for app_2_add in self.application_2_add:
                    app_2_add.sync()
            if self.application_2_rm is not None:
                for app_2_rm in self.application_2_rm:
                    app_2_rm.sync()
            if self.environment_2_add is not None:
                for env_2_add in self.environment_2_add:
                    env_2_add.sync()
            if self.environment_2_rm is not None:
                for env_2_rm in self.environment_2_rm:
                    env_2_rm.sync()
            if self.team_2_add is not None:
                for team_2_add in self.team_2_add:
                    team_2_add.sync()
            if self.team_2_rm is not None:
                for team_2_rm in self.team_2_rm:
                    team_2_rm.sync()

        self.embedded_osi_2_add.clear()
        self.embedded_osi_2_rm.clear()
        self.ip_address_2_add.clear()
        self.ip_address_2_rm.clear()
        self.nic_2_add.clear()
        self.nic_2_rm.clear()
        self.subnets_2_add.clear()
        self.subnets_2_rm.clear()
        self.application_2_add.clear()
        self.application_2_rm.clear()
        self.environment_2_add.clear()
        self.environment_2_rm.clear()
        self.team_2_add.clear()
        self.team_2_rm.clear()
        self.sync()
        return self