You could use PathAddress/PathElement here it will ease the code.
Also you could use Util.createAddOperation(...)