attachment resultset improvments

- fixed the StoredItemAttachment view for the case where an
  item attachment is not marked as deleted, but its source item is.
- cleaned up the SQL for StoredItem and StoredItemAttachment
- allowed for choosing the which ItemAttachment resultset to search over
  for attachments (`with_item_attachment_resultset`)
test of `with_item_attachment_resultset` method