SharePoint: CSOM break folder permissions

Consider a scenario where you need to break permissions of a folder using client object model (CSOM) in SharePoint. The code below creates a folder in the document library, breaks its permissions and gives a particular user Contribute permissions on it. The main thing to note here is that, in CSOM Folder does not have BreakRoleInheritance or Item method. It has a property named ListItemAllFields. This is used to break permissions as shown: