class SharedServiceConfigProvider {

    @Measure(SharedServiceConfigProvider.class)
    public Stack prepareDatalakeConfigs(Stack publicStack) {
        try {
            Optional<DatalakeResources> datalakeResource = Optional.empty();
            Set<DatalakeResources> datalakeResources = datalakeResourcesService
                    .findDatalakeResourcesByWorkspaceAndEnvironment(publicStack.getWorkspace().getId(), publicStack.getEnvironmentCrn());
            if (publicStack.getDatalakeResourceId() != null || (!CollectionUtils.isEmpty(datalakeResources) && datalakeResources.size() == 1)) {
                Long datalakeResourceId = getDatalakeResourceIdFromEnvOrStack(publicStack, datalakeResources);
                datalakeResource = datalakeResourcesService.findById(datalakeResourceId);
            } else {
                if (publicStack.getDatalakeResourceId() == null) {
                    LOGGER.debug("Datalake resource id was null, therefore unable to fetch resource(s)!");
                }
                if (CollectionUtils.isEmpty(datalakeResources)) {
                    LOGGER.debug("No datalake resource(s) has been found for environment: {}", publicStack.getEnvironmentCrn());
                }
            }
            if (decorateStackWithConfigs(publicStack, datalakeResource)) {
                return stackService.save(publicStack);
            }
            return publicStack;
        } catch (IOException e) {
            String baseMessage = "Could not propagate cluster input parameters";
            LOGGER.warn(baseMessage);
            throw new BadRequestException(baseMessage + ": " + e.getMessage(), e);
        }
    }

}