public IEnumerable<IRegistration> GetRegistrationsFor(NancyContainer container, Type serviceType)
        {
            if (serviceType != null && serviceType.IsGenericTypeDefinedBy(typeof(Func<>)))
            {
                var baseServiceType = serviceType.FunctionReturnType();
                var baseServiceRegistrations = container.GetRegistrations(baseServiceType, null);

                var newRegistrations = new List<IRegistration>();
                foreach (var registration in baseServiceRegistrations)
                {
                    var factory = FuncGenerator.CreateDelegate(serviceType, container, registration.Name);

                    newRegistrations.Add(new FactoryRegistration(serviceType, c => factory, registration.Name));
                }
                return newRegistrations.AsEnumerable();
            }

            return Enumerable.Empty<IRegistration>();
        }
        public IEnumerable<IRegistration> GetRegistrationsFor(NancyContainer container, Type serviceType)
        {
            if (CanCreateRegistrationsFor(serviceType))
            {
                Type genericTypeDefinition = serviceType.GetGenericTypeDefinition();
                Type[] genericArguments = serviceType.GetGenericArguments();

                var newRegistrations = new List<IRegistration>();
                foreach (var registration in container.GetRegistrations(genericTypeDefinition, null))
                {
                    var typeRegistration = registration as TypeRegistration;
                    if (typeRegistration != null)
                    {
                        var implType = typeRegistration.ImplementationType.MakeGenericType(genericArguments);
                        newRegistrations.Add(new TypeRegistration(registration.Name, serviceType, implType));
                    }
                }
                return newRegistrations.AsEnumerable();
            }

            return Enumerable.Empty<IRegistration>();
        }