Fix save operation when document has a custom id

refs #138