Michael Avenatti tested legal boundaries as his firm maneuvered into bankruptcy