/// <summary>
        /// Generates the copy class.
        /// </summary>
        /// <param name="sourceType">Type of the source.</param>
        /// <param name="targetType">Type of the target.</param>
        /// <returns></returns>
        public Type GenerateCopyClass(Type sourceType, Type targetType)
        {
            var className = CopyProviderHelper.GetClassName(sourceType, targetType);

            if (_comp.TryGetValue(className, out var type))
            {
                return(type);
            }

            var unit = new CodeCompileUnit();

            var ns = CreateNamespace();

            unit.Namespaces.Add(ns);

            var targetClass = CreateClass(className);

            ns.Types.Add(targetClass);

            var copyMethod = CreateCopyMethod(sourceType, targetType);

            targetClass.Members.Add(copyMethod);

            var copyActionMethod = CreateCopyActionMethod(sourceType, targetType, copyMethod);

            targetClass.Members.Add(copyActionMethod);

            Debug.WriteLine(unit.ToString());

            var results = BuildAssembly(unit, targetType.Assembly);

            // Compiler output

            foreach (var line in results.Output)
            {
                Debug.WriteLine(line);
            }

            var copierType = results.CompiledAssembly.GetType(NamespaceName + "." + className);

            _comp.Add(className, copierType);

            return(copierType);
        }