/// <summary>
 /// Method to register a surrogate in order to save the State of the method being executed.
 /// </summary>
 /// <param name="codePromiseType"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 internal static void RegisterSurrogateForDisplayClass(Type codePromiseType, object target, string parentSurrogateId = null)
 {
     //Lets register the surrogate only if it's not already registered.
     if (!SurrogatesDirectory.IsSurrogateRegistered(codePromiseType))
     {
         var signature = SurrogatesDirectory.GenerateNewSurrogateFromType(codePromiseType);
         var surrogateForDisplayClass = new SurrogateForDisplayClass(codePromiseType, signature);
         SurrogatesDirectory.RegisterSurrogate(
             signature: signature,
             supportedType: codePromiseType,
             serializeEx: surrogateForDisplayClass.Serialize,
             deserializeEx: surrogateForDisplayClass.Deserialize,
             calculateDependencies: new SurrogateDependencyCalculation[] { surrogateForDisplayClass.CalculateDependencies });
     }
 }