Allen & Overy (A&O) and Herbert Smith Freehills (HSF) have won roles as private equity companies Exponent and Electra Partners agree to buy PhotoBox for around £400m.

Photo printing company PhotoBox is the owner of a range of businesses including gift card service Moonpig which it purchased for £120m in 2011.

The deal comes a year after the company scrapped plans for an initial public offering (IPO) due to volatile markets.

A&O is advising Exponent and Electra Partners' purchasing vehicle on its binding offer. Its London based team is being led by corporate private equity partner Gordon Milne alongside fellow corporate private equity partner Karan Dinamani, banking partner David Lines and antitrust partner Alasdair Balfour.

The deal is the fourth major consumer goods related transaction A&O has worked on in the last three months.

Earlier this month, A&O won a role advising UK ice cream company R&R and its private equity owner PAI on its proposed joint venture with Nestle, reportedly valued at €3bn (£2.2bn).

A&O is also advising Exponent on the sale of Quorn Foods to Philippines consumer goods company Monde Nissan for £550m. The sale, announced on 30 September, is expected to complete by 30 October.

Previously, the magic circle firm advised Coca-Cola Iberian Partners on a €28bn (£19.71bn) bottling joint venture with two other European Coca-Cola bottlers in August.

Shearman & Sterling is also advising Electra Partners on this week's deal. Shearman's team in London is being led by private equity partner Mark Soundy, tax partner Sarah Priestley and finance partner Peter Hayes.

HSF is advising PhotoBox with a team led by London corporate partner Ben Ward.

The firm previously advised PhotoBox in November last year on its acquisition of Hofmann, Spain's online photobook company.