/// <summary>
        /// Extension method that determines if the logger field is implemented in the class. If it exists will return the provided source. Otherwise will add the logging namespace and the logger field.
        /// </summary>
        /// <param name="source">Source class to check for the logger field.</param>
        /// <param name="loggerName">The name of the logger field to check for.</param>
        /// <param name="parentSourceCode">The source code the class was loaded from.</param>
        /// <returns>The existing source code if the field is found, or the updated source code with the logging field added.</returns>
        public static async Task <CsSource> AddMicrosoftExtensionsLoggerFieldAsync(this CsClass source, string loggerName,
                                                                                   CsSource parentSourceCode)
        {
            //Bounds checking
            if (source == null)
            {
                return(parentSourceCode);
            }
            if (String.IsNullOrEmpty(loggerName))
            {
                return(parentSourceCode);
            }

            //Checking to see if the logger field already exists. If it does just return the parent source code.
            if (source.HasMicrosoftExtensionsLoggerField(loggerName))
            {
                return(parentSourceCode);
            }

            //Adding the logging namespace
            var currentSource = await parentSourceCode.AddUsingStatementAsync(NetConstants.MicrosoftLoggerNamespace);

            var currentClass = currentSource.GetModel(source.LookupPath) as CsClass;

            if (currentClass == null)
            {
                throw new CodeFactoryException("Cannot load class data to add the logger field.");
            }

            CodeFactory.SourceFormatter fieldSource = new CodeFactory.SourceFormatter();

            fieldSource.AppendCodeLine(2, "/// <summary>");
            fieldSource.AppendCodeLine(2, "/// Logger for all logging interactions in the class.");
            fieldSource.AppendCodeLine(2, "/// </summary>");
            fieldSource.AppendCodeLine(2, $"private readonly {NetConstants.MicrosoftLoggerInterfaceName} {loggerName};");
            fieldSource.AppendCodeLine(0);

            currentSource = await currentClass.AddToBeginningAsync(fieldSource.ReturnSource());

            return(currentSource);
        }