Fix fromAnnotations in TermAttachmentSerializer sometimes turning annotations into lists of annotations.
Simplify index serialisation code.