/// <summary>
 /// Iterates on the dependencies queue expanding all calculated dependendies inside
 /// this same queue
 /// </summary>
 /// <param name="queue"></param>
 private void ExpandDependencies(DependenciesQueue queue)
 {
     //Process all generated dependencies.
     while (queue.PendingCount != 0)
     {
         var resolutionInfo   = queue.Pop();
         var objectValue      = resolutionInfo.value;
         var dependencyValues = SurrogatesDirectory.GetObjectDependencies(objectValue, _stateManager, _stateManager.surrogateManager, this);
         foreach (var dependencyValue in dependencyValues)
         {
             if (dependencyValue != null)
             {
                 DependencyResolutionInfo resolutionInfoForDependency;
                 if (!queue.TryGetValue(dependencyValue, out resolutionInfoForDependency))
                 {
                     queue.Add(dependencyValue, resolutionInfoForDependency = new DependencyResolutionInfo());
                 }
                 queue.RegisterParentDependency(new DependencyParentInfo()
                 {
                     child = resolutionInfoForDependency, ParentValue = objectValue, ParentSurrogate = resolutionInfo.ResolvedSurrogate
                 });
             }
             else
             {
                 queue.RegisterParentDependency(new DependencyParentInfo()
                 {
                     child = null, ParentValue = objectValue, ParentSurrogate = resolutionInfo.ResolvedSurrogate
                 });
             }
         }
     }
 }