how to use ai for legacy system modernization