UI-2045: remove some duplicate code