Aimed at improving its prognosis in the long-term care space, Woonsocket, Rhode Island-based CVS Health Corp. plans to purchase Cincinnati-based Omnicare Inc. for $12.7 billion, including debt. Announced Thursday, the deal for Omnicare is expected to close by the end of the year.

Back in 2006, CVS picked up pharmacy benefits manager Caremark Rx Inc. for $21 billion, nearly double the price it’s putting up for Omnicare. Davis Polk & Wardwell took the lead for CVS on that deal, as well as the company’s subsequent $2.7 billion buy of Long Drugs in 2008 and first-ever international acquisition in 2013.