internal static async Task SetPropertyAndWriteStateAsync <TGrainState>(Action <TGrainState> setterAction, IIndexedState <TGrainState> indexedState, bool retry)
            where TGrainState : class, new()
        {
            const int MaxRetries = 10;
            int       retries    = 0;

            while (true)
            {
                try
                {
                    await indexedState.PerformUpdate(setterAction);

                    return;
                }
                catch (Exception) when(retry && retries < MaxRetries)
                {
                    ++retries;
                    await indexedState.PerformRead();
                }
            }
        }
 public static Task PerformRead <TGrainState>(this IIndexedState <TGrainState> indexedState)
     where TGrainState : class, new()
 => indexedState.PerformRead(_ => true);