Updated 'extend' function.
Refactored the function to copy properties from one object to another one and avoid properties overriding. This way we ensure the 'inheritance' of <xsd:extension base=...> usage.