class FormEditorHelper {

    public FieldDefinition getFormField(String fieldId) {
        FieldDefinition result = content.getDefinition().getFieldById(fieldId);
        if (result == null) {

            result = availableFields.get(fieldId);

            if (result == null) {
                if (unbindedFields.containsKey(fieldId)) {
                    Pair<EditorFieldLayoutComponent, FieldDefinition> pair = unbindedFields.get(fieldId);

                    result = pair.getK2();

                    result.setLabel(result.getFieldType().getTypeName());
                    if (result instanceof HasPlaceHolder) {
                        ((HasPlaceHolder) result).setPlaceHolder(result.getFieldType().getTypeName());
                    }

                    unbindedFields.remove(result.getId());

                    FieldDefinition newField = fieldManager.getDefinitionByFieldType(result.getFieldType());
                    newField.setName(generateUnboundFieldName(newField));

                    EditorFieldLayoutComponent component = pair.getK1();

                    component.init(content.getRenderingContext(),
                                   newField);

                    unbindedFields.put(newField.getId(),
                                       new Pair<>(component,
                                                  newField));
                }
            }
        }
        return result;
    }

    @Inject public  FormEditorHelper(FieldManager fieldManager,
                            ManagedInstance<EditorFieldLayoutComponent> editorFieldLayoutComponents,
                            SyncBeanManager beanManager);

}