Rules import/export plus some code cleanup

contains some code cleanup:
1. assigning ids to collections
2. updating collection on add/remove/update rules in efficient way
3. moved templates definition in router to respective views

Already ensured backward compatibility due to change in structure of rule. (new 'id' attribute added)

Added feature of import/export rules from Index page.