public function indexAction(Request $request)
    {
        $form = $this->createForm(new ExtendableConfigurationType($this->get('madrak_io_extendable_configuration.extendable_configuration_chain')->getBuiltConfiguration()));
        $form->setData($this->get('madrak_io_extendable_configuration.configuration_service')->getAll());

        $form->handleRequest($request);

        if ($form->isValid() === true) {
            $entityClass = $this->getParameter('madrak_io_extendable_configuration.configuration_class');
            $entityManager = $this->get('doctrine.orm.default_entity_manager');
            $repository = $entityManager->getRepository($entityClass);

            $recursiveIteratorIterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($form->getData()['configuration']));
            foreach ($recursiveIteratorIterator as $configurationValue) {
                $keys = [];
                for ($depth = 0; $depth <= $recursiveIteratorIterator->getDepth(); ++$depth) {
                    $keys[] = $recursiveIteratorIterator->getSubIterator($depth)->key();
                }

                $configurationField = implode('.', $keys);

                $configurationEntity = $repository->findOneBy(['field' => $configurationField]);
                if (($configurationEntity instanceof $entityClass) === false) {
                    $configurationEntity = new $entityClass();
                    $configurationEntity->setField($configurationField);
                }

                $configurationEntity->setValue($configurationValue);

                $entityManager->persist($configurationEntity);
            }

            $entityManager->flush();
        }

        return $this->render('MadrakIOExtendableConfigurationBundle:Configuration:edit.html.twig',
                                [
                                    'parent_template' => $this->getParentTemplate(),
                                    'form' => $form->createView(),
                                ]);
    }