this pattern is using in few places. please extract to view helper