Mitigating AI Integration Risks in Legacy Systems