refactor LayoutManager::save() to remove code repetition
Hey, first KDE contribution here. I was digging through code trying to fix bug 427530 when I found this copied-and-pasted block in LayoutManager::save(). This MR moves the block into a lambda to remove code repetition.
I am not a C++ programmer and although nothing changed that I could notice, it would be smart to sanity check and/or test this before merging.