Here is another example:
Introducing the Command Design Pattern in Unreal Engine 4 - YouTube
it’s same idea as shared above, but the commands are wrapped into objects. For undo some materials it is not likely needed, however if you wanted to watch some step-by-step I thought it may be worth a share.