static void UpdateControllerServices <T>(ServicesContainer services, IComponentContext container, ControllerTypeKey serviceKey) where T : class
        {
            var resolvedInstances = container.ResolveOptionalKeyed <IEnumerable <Meta <T> > >(serviceKey).ToArray();

            if (resolvedInstances.Any(service => ClearExistingServices(service.Metadata)))
            {
                services.Clear(typeof(T));
            }

            foreach (var instance in resolvedInstances)
            {
                services.Add(typeof(T), instance.Value);
            }
        }