functional programming in scala - bulk commit