Custom bibliography that includes 'Order of Appearance'

Yes i do use a numbered style for my references into the document and i would like to sort my references inside the endnote with the same order. The field “order of appearance” is very usefull but numbers, which represent the order of appearance, are given manually by the author. in order to provide an example let’s say that you have only tow references, A and B, in the text and these are in tow different paragraphs each and these are given the number [1] and [2] from the numbered style in the document. You give number 1 to A and 2 to B in the “oder of appearance” field. If you want to change the order of the paragraphs then the refrence B will come first and the number [1] will be assigned from the numbered sytle in the text. The reference A will then be second and the number [2] will be given respectively. However, inside endnote the reference A will still have number 1 and B number 2 in the field “order of appearance” and the author must change these manually. The question is how can the references be sorted inside the endnote following the order of appearance from the document. I hope that the example is clear.