Moved some duplicate code to a function. Moreover, do not restart the dns forwarding service when adding a domain override, but instead mark the hosts subsystem as dirty.