Refactoring videoDialog, imageDialog with promise.