Started work on improving attachments.

Added an isDirty() method that checks attachments.
Made saveAttachment() work and wrote some unit tests to prove it.