public void Run()
        {
            try
            {
                var dependencySet = new ObjectBuilders.BuiltDependencies <TAddress>();
                if (this.Dependencies.Any(tuple => tuple.Item2.ObjectBuildingState != ObjectBuildingStates.ObjectBuilt))
                {
                    this.ObjectBuilderInfo.SetObjectFailed(new InvalidOperationException("Dependency Failed"));
                    return;
                }

                foreach (var entry in this.Dependencies)
                {
                    dependencySet.AddDependency(entry.Item1.Name,
                                                entry.Item1.Address,
                                                entry.Item2.BuiltObject);
                }

                var context = new ObjectBuilders.ObjectBuilderBuildObjectContext <TAddress>(this.ObjectBuilderInfo.ObjectContext);

                var builtObject = this.ObjectBuilderInfo.ObjectBuilder.BuildObject(context, this.ObjectBuilderInfo.Address, dependencySet);

                this.ObjectBuilderInfo.SetObjectBuilt(builtObject);
            }
            catch (Exception ex)
            {
                this.ObjectBuilderInfo.SetObjectFailed(ex);
            }
        }
        private void RunGetAdditionalDependencies()
        {
            try
            {
                var dependencySet = new ObjectBuilders.BuiltDependencies <TAddress>();
                if (this.Dependencies.Any(tuple => tuple.Item2.ObjectBuildingState != ObjectBuildingStates.ObjectBuilt))
                {
                    this.ObjectBuildingInfo.SetObjectFailed(new InvalidOperationException("Dependency Failed"));
                    return;
                }

                foreach (var entry in this.Dependencies)
                {
                    dependencySet.AddDependency(entry.Item1.Name,
                                                entry.Item1.Address,
                                                entry.Item2.BuiltObject);
                }

                var context = new ObjectBuilders.ObjectBuilderGetAdditionalDependenciesContext <TAddress>(this.ObjectBuildingInfo.ObjectContext);

                var additionalDependencies = this.ObjectBuildingInfo.ObjectBuilder.GetAdditionalDependencies(context, this.ObjectBuildingInfo.Address, dependencySet);

                IEnumerable <ObjectBuilders.IDependency <TAddress> > combinedDependencies = this.Dependencies.Select(tuple => tuple.Item1);
                if (additionalDependencies != null)
                {
                    combinedDependencies = combinedDependencies.Concat(additionalDependencies.Dependencies);
                }

                if (additionalDependencies == null || !additionalDependencies.RecursiveMode)
                {
                    // Say that the dependencies are now know...
                    var requestedDependencies = new RequestedDependencies <TAddress>(
                        false,
                        combinedDependencies);

                    this.ObjectBuildingInfo.SetRequestedDependencies(requestedDependencies);
                }
                else if (additionalDependencies.RecursiveMode)
                {
                    var dependencyTuples = new List <Tuple <ObjectBuilders.IDependency <TAddress>, IObjectBuildingInfo <TAddress> > >();
                    // Recursive mode
                    foreach (var dependency in combinedDependencies)
                    {
                        var dependencyObjectBuildingInfo = this.ObjectBuildingInfo.ObjectContext.BuildObject(dependency.Address);
                        var tuple = Tuple.Create(dependency, dependencyObjectBuildingInfo);
                        dependencyTuples.Add(tuple);
                    }

                    var callBackHandler = new ObjectBuilderRecursiveDependenciesCallBackHandler <TAddress>(
                        this.ObjectBuildingInfo,
                        dependencyTuples);

                    foreach (var tuple in dependencyTuples)
                    {
                        tuple.Item2.RegisterPostBuildCallBack(callBackHandler.PostDependencyBuildCallBack);
                    }
                }
            }
            catch (Exception ex)
            {
                this.ObjectBuildingInfo.SetObjectFailed(ex);
            }
        }