as much as somebody can/could do to do something
as much as (one) could do (not) (to do something)
A phrase used when one struggles to do something. It can include "not" when one is trying to avoid doing something. It was as much as I could do to keep from crying when the teacher yelled at me in front of the whole class. It was as much as I could do not to start laughing when my three-year-old told my boss she looked like a "meanie."