/// <summary>
        /// Converts from the Representation back to the original.
        /// </summary>
        /// <param name="assemblyRepresentation">The assembly representation.</param>
        /// <returns>
        /// The assembly.
        /// </returns>
        public static Assembly FromRepresentation(
            this AssemblyRepresentation assemblyRepresentation)
        {
            if (assemblyRepresentation == null)
            {
                throw new ArgumentNullException(nameof(assemblyRepresentation));
            }

            var allAssemblies = AppDomain.CurrentDomain.GetAssemblies();

            var results = allAssemblies
                          .Where(_ => _.ToRepresentation().Equals(assemblyRepresentation))
                          .ToList();

            if (!results.Any())
            {
                throw new ArgumentException(Invariant($"Could not find an assembly that matched representation '{assemblyRepresentation}' in '{nameof(AppDomain)}'."));
            }

            if (results.Count > 1)
            {
                var foundAddIn = string.Join(",", results.Select(_ => _.ToString()));

                throw new ArgumentException(Invariant($"Found too many assemblies that matched representation '{assemblyRepresentation}' in '{nameof(AppDomain)}'; {foundAddIn}."));
            }

            var result = results.Single();

            return(result);
        }
        /// <summary>
        /// Reads the assembly to create a new <see cref="AssemblyRepresentation"/>.
        /// </summary>
        /// <param name="assembly">The assembly object to interrogate.</param>
        /// <returns>
        /// Details about an assembly.
        /// </returns>
        public static AssemblyRepresentation ToRepresentation(
            this Assembly assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            var codeBasesToIgnore = new List <string>(new[] { "Microsoft.GeneratedCode", "Anonymously Hosted DynamicMethods Assembly" });

            var asmName = assembly.GetName();

            var frameworkVersionNumber = assembly.ImageRuntimeVersion.Substring(1, 3);

            var version = asmName.Version.ToString();

            var name = asmName.Name;

            var codeBase = codeBasesToIgnore.Contains(name) ? name : assembly.GetCodeBaseAsPathInsteadOfUri();

            var result = new AssemblyRepresentation(name, version, codeBase, frameworkVersionNumber);

            return(result);
        }