With margins expected to decline, mortgage companies are looking to cut costs. Options include outsourcing and automation.