/// <summary>
        /// Registers the TService with the factory that describes the dependencies of the service, as a singleton.
        /// </summary>
        /// <typeparam name="TService">
        /// The type of the service instance.
        /// </typeparam>
        /// <param name="container">
        /// The container.
        /// </param>
        /// <param name="factory">
        /// The factory.
        /// </param>
        /// <param name="serviceName">
        /// The service Name.
        /// </param>
        internal static void RegisterSingleton <TService>(this IServiceRegistry container, Func <IServiceFactory, TService> factory, string serviceName)
        {
            var registration = container.GetAvailableService <TService>(serviceName);

            if (registration == null)
            {
                container.Register(factory, serviceName, new PerContainerLifetime());
            }
            else
            {
                container.UpdateRegistration(registration, null, factory);
            }
        }
        /// <summary>
        /// Registers the TService with the TImplementation as a singleton.
        /// </summary>
        /// <typeparam name="TService">
        /// The type of the service
        /// </typeparam>
        /// <typeparam name="TImplementation">
        /// The type of the instance
        /// </typeparam>
        /// <param name="container">
        /// The container.
        /// </param>
        internal static void RegisterSingleton <TService, TImplementation>(this IServiceRegistry container)
            where TImplementation : TService
        {
            var registration = container.GetAvailableService <TService>();

            if (registration == null)
            {
                container.Register <TService, TImplementation>(new PerContainerLifetime());
            }
            else
            {
                container.UpdateRegistration(registration, typeof(TImplementation), null);
            }
        }