public void setProfile(final Set<String> indexSetsIds,
                           final String profileId,
                           final boolean rotateImmediately) {
        checkProfile(profileId);
        checkAllIndicesSupportProfileChange(indexSetsIds);

        for (String indexSetId : indexSetsIds) {
            try {
                indexSetService.get(indexSetId).ifPresent(indexSetConfig -> {
                    var updatedIndexSetConfig = setProfileForIndexSet(profileId, indexSetConfig);
                    if (rotateImmediately) {
                        updatedIndexSetConfig.ifPresent(this::cycleIndexSet);
                    }
                });
            } catch (Exception ex) {
                LOG.error("Failed to update field type in index set : " + indexSetId, ex);
                throw ex;
            }
        }
    }
@Test
    void testDoesNothingWhenAskedToSetProfileWhichWasAlreadySet() {
        existingIndexSet = existingIndexSet.toBuilder()
                .fieldTypeProfile("000000000000000000000007")
                .build();
        doReturn(Optional.of(existingIndexSet)).when(indexSetService).get("existing_index_set");
        final String profileId = "000000000000000000000007";
        IndexFieldTypeProfile profile = new IndexFieldTypeProfile(
                profileId,
                "Nice profile!",
                "Nice profile!",
                new CustomFieldMappings(List.of(new CustomFieldMapping("bubamara", "ip")))
        );
        doReturn(Optional.of(profile)).when(profileService).get(profileId);
        toTest.setProfile(Set.of(existingIndexSet.id()), profileId, false);

        verify(mongoIndexSetService, never()).save(any());
        verifyNoInteractions(existingMongoIndexSet);
    }