Refactorinf of the dialog and controller for insert links