Refactor WebApplication