refactor rest, mvc and orm