title: How can I get Kentico 8.0 to properly update document attachments when Publishing a document that has been edited via the API?
body: <p><strong>The Scenario:</strong></p>
  
  <p>We've got an Angular front end bolted on top of a Kentico 8.0 instance.
  Users are able to view, add, and edit documents through the this front end.
  When a user adds/edits a document, the relevant details are posted to a custom handler which then updates the documents through the Kentico API (C#), and moves them around in the workflow as appropriate. Currently it's placing added/edited documents into the 'Approve' step, and then Admins can publish through the back end. The users are allowed to attach a list of images to the document through the API.</p>
  
  <p>We're using a simple workflow that goes Edit -> Approve -> Published.
  Both add and edit move the document to Edit, make changes, move it to Approve, and then save changes (node.Update()). Publishing happens from the Kentico Admin side.</p>
  
  <p><strong>The Problem:</strong></p>
  
  <p>General document editing appears to work fine... but I'm having issues with the attachments. Users can create new documents and attach images without an issue. On submit (which places the document in the "Approve" step), the attachments are pushed into the CMS_AttachmentHistory table, but do not appear in the CMS_Attachment table. Seems reasonable. Once an Admin publishes the document the attachments are pushed into the CMS_Attachment table as well. Still reasonable.
  If I now edit (which moves the document to the edit step, updates data, then moves it to the approve step, then saves it) and make changes to the attachments... those attachment changes appear in the CMS_AttachmentHistory table as I expect... but when I then publish the document as Admin the CMS_Attachment table remains unchanged.</p>
  
  <p>I can't figure out why on the add -> publish the attachments are pushed to CMS_Attachment table properly, but on edit -> publish they are not. Obviously something is different... but the code that updates is identical... the only exception being the node.insert() for a new document. The both start in the edit phase, have changes made, get moved to approve and then get saved. Presumably document publish is identical in both cases.</p>
  
  <p>I can't find anything in the documentation about a way to manually move the attachments around in the workflow... I'm not sure if that's something I need to do but it seems weird that it works for add, just not edit.</p>
  
  <p>I can provide code if needed, but it doesn't seem like it would be that helpful in this case.</p>
  
  <p>Edit: Added more detail about the workflow setup</p>