refactor views crud controller