Looks like the only closure this function uses is `attributeIds`. I would make it a parameter and move the function outside of `store` to reduce the size of `store` function. Also, a comment on what this function does would help :)