Concurrent creation of line
syncLines can be called many times while the promises to create new lines from the previous call are not yet resolved.
In this case a second creation is sent and the result is that those lines are created many times.
To avoid this case, I propose to unmark as dirty lines for which a promise is created. This will avoid any further call to fire a second call.
With this design, we can even find if the line was changed in between the call and the response because the line will be marked again as dirty. So in this case we should keep the modified values (and just get the new id for creation).