Simplify logic with lodash
Remove unnecessary attributes