This code helps and I think it does go back to the statement I made before about some confusion about the difference between an occurrence and a body. Here's a quick overview.
Body - The result of creating surfaces or solids in a part. Solids are shown in the "Solid Bodies" folder in the browser and surfaces are shown in the "Surface Bodies" folder in the browser. In the API both solids and surfaces are represented by the SurfaceBody object. There is an IsSolid property on the object that indicates if it's representing a surface or solid. Within a part you can assign a color to a body which overrides the part color. You can also assign colors to individual features and faces.
ComponentOccurrence - An occurrence represents an instance of a part or assembly within an assembly. Each time you place a part or an assembly into an assemblyl you're creating a new ComponentOccurrence. An occurrence doesn't have any geometry on it's own but displays the geometry in the part or assembly that it references. In an assembly you can change the color of an occurrence, which overrides the color as defined in the referenced part or assembly. This is an override in the assembly and doesn't affect the original part or assembly. Inventor also supports changing the color of a body within an occurrence which is also an override of the color defined in the original part. Overriding the colors of features or faces is not supported in an assembly but can only be changed in the original part.
For example, let's say there is a part (cubes.ipt) that contains two cubes, each one being a unique body in the part. Now, if we insert this part two times into an assembly we'll have two occurrences that both reference cubes.ipt. If you make any changes to cubes.ipt and then open the assembly you'll see thouse changes reflected in both occurrences because they're referencing cubes.ipt.
Proxy - A proxy is an object that represents another object within a assembly. For the example above there are two bodies; the two cubes in cubes.ipt. However, when we look at the assembly we see four cubes because we have to occurrences of cubes.ipt. These four cubes don't actually exist in the assembly Inventor makes it appear that they do. It does this through proxies. There is a unique proxy object for each of the four cubes. If you change the color of one of the cubes you're actually overriding the color on the SurfaceBodyProxy that represents that specific cube.
In your code you're starting off by selecting three different occurrences, not bodies. The ComponentOccurrence object has a SurfaceBodies property which returns the SurfaceBodyProxy objects associated with that occurrence. You can set the appearance of these and it will change the color for that specific body proxy in the assembly. Since the color is being assigned to something in the assembly, the appearance must be copied to the AssemblyDocument before it can be used.
The ComponentOccurrence object also supports the Definition property which you are using. If the occurrence represents a part, this returns the PartComponentDefinition of the part being referenced. This means you've completely left the context of the assembly and are working only within the part. You can do anything you would usually do with a part. Changing colors here will change the colors in the part and you'll see it in all instances in the assembly. For example, if I change the color of one of the cubes, in the assembly two cubes will change color because two of the cubes represent the same cube in the part.
I know this can all be a bit confusing and I'm happy to try and explain more if you need it.