Fix problem with disappearing client notes

Only create a new client object if there is nothing set in
the Workflow.Errand object.
Without this check a new client object is created everytime a client
note is saved. This causes the other notes to "disappear" and also
created duplicate client objects.
Fix problem with disappearing thread notes

Every time a thread note was saved then the Workflow.Thread object
was replaced in the Workflow.Errand object with a new.
This caused thread notes to "disappear" (there really were in the old thread object).
Fix this by only creating a Workflow.Thread object if the errand does not have one.
Fix problem with attachments not showing in client notes

Closure was returning wrong array.