DF-1979. Refactor repeating code