Fixed bug where model id was not being returned from leaf serializer, Ticket0301
Ticket0788: When attachment is opened, check its source to decide whether to create or update