Can we reduce the boilerplate with foreach?