Extensive refactoring

* Refactor MasterDetailController and split into TableController, TableService