class EmbeddedSensorCreationStrategy implements IResolveDependencyStrategy {

    @Override
    public <T> T resolve(final Object... args) throws ResolveDependencyStrategyException {
        try {
            Object statisticsChainId = args[CHAIN_ID_STRATEGY_ARGUMENT_INDEX];
            IObject conf = (IObject) args[CONFIG_STRATEGY_ARGUMENT_INDEX];

            IObject commonArgs = (IObject) conf.getValue(argsFieldName);
            Collection<IObject> embedConf = (Collection<IObject>) conf.getValue(embedFieldName);
            List<IObject> replacements = new ArrayList<>(embedConf.size());

            Object targetChainId = IOC.resolve(Keys.getOrAdd("chain_id_from_map_name"), conf.getValue(chainFieldName));
            IChainStorage chainStorage = IOC.resolve(Keys.getOrAdd(IChainStorage.class.getCanonicalName()));

            for (IObject embedItemConf : embedConf) {
                IObject itemArgs = (IObject) embedItemConf.getValue(argsFieldName);
                itemArgs = (itemArgs == null) ? commonArgs : itemArgs;
                final Object itemDependency = embedItemConf.getValue(dependencyFieldName);

                itemArgs.setValue(statisticsChainFieldName, statisticsChainId);

                IMessageReceiver sensor = IOC.resolve(
                        IOC.resolve(IOC.getKeyForKeyStorage(),
                                (itemDependency == null) ? DEFAULT_RECEIVER_DEPENDENCY : itemDependency),
                            itemArgs
                        );

                IObject replacement = IOC.resolve(Keys.getOrAdd("info.smart_tools.smartactors.iobject.iobject.IObject"));

                replacement.setValue(stepFieldName, embedItemConf.getValue(stepFieldName));
                replacement.setValue(dependencyFieldName, SENSOR_RECEIVER_REPLACEMENT_DEPENDENCY);
                replacement.setValue(argsFieldName, sensor);

                replacements.add(replacement);
            }

            IObject modification = IOC.resolve(Keys.getOrAdd("info.smart_tools.smartactors.iobject.iobject.IObject"));

            modification.setValue(modificationFieldName, RECEIVER_REPLACEMENT_MODIFICATION_DEPENDENCY);
            modification.setValue(replacementsFieldName, replacements);

            Object modId = chainStorage.update(targetChainId, modification);

            return (T) new EmbeddedSensorHandle(chainStorage, targetChainId, modId);
        } catch (ReadValueException | ChangeValueException | InvalidArgumentException | ResolutionException | ChainNotFoundException
                | ChainModificationException e) {
            throw new ResolveDependencyStrategyException(e);
        }
    }

    public  EmbeddedSensorCreationStrategy();

}