private function resolveDataSource(FormInterface $form)
    {
        if ($form->isRoot()) {
            // Nothing to do if root
            $dataForm = $form->getData();
        } else {
            $dataForm = $form;
            while ($dataForm->getConfig()->getDataClass() === null) {
                $dataForm = $form->getParent();
            }
        }

        $data = $dataForm->getData();
        return array(
            $data,
            $data === null ? $dataForm->getConfig()->getDataClass() : get_class($data)
        );
    }