[webui][api] moved field checks to controller and some more refactoring.