Reorganize some controller code, refactor and save all stuff on workorder