Speed up XML import

- write grouped_model_data only at the end of data tag
- order record by id

issue4079
review10451002
Improve get_action on Menu

review5481002