void INotifiable.OnUpdate(Map properties, IInternalDataStore dataStore)
        {
            var newProperties = new Dictionary<string, object>(2);

            bool hasProperties = !properties.IsNullOrEmpty();
            if (hasProperties)
            {
                newProperties.Add(IsNewAccountPropertyName, properties[IsNewAccountPropertyName]);
                properties.Remove(IsNewAccountPropertyName);

                var account = dataStore.InstantiateWithData<IAccount>(properties);
                newProperties.Add(AccountPropertyName, account);

                this.GetResourceData()?.Update(newProperties);
            }
        }
        void INotifiable.OnUpdate(Map properties, IInternalDataStore dataStore)
        {
            var newProperties = new Dictionary <string, object>(2);

            bool hasProperties = !properties.IsNullOrEmpty();

            if (hasProperties)
            {
                newProperties.Add(IsNewAccountPropertyName, properties[IsNewAccountPropertyName]);
                properties.Remove(IsNewAccountPropertyName);

                var account = dataStore.InstantiateWithData <IAccount>(properties);
                newProperties.Add(AccountPropertyName, account);

                this.GetResourceData()?.Update(newProperties);
            }
        }
        internal static IAccountResult CreateAccountResult(IJwtClaims claims, IInternalDataStore dataStore)
        {
            var state = claims.GetClaim(IdSiteClaims.State);

            bool isNewAccount = (bool)claims.GetClaim(IdSiteClaims.IsNewSubject);
            var  resultStatus = GetResultStatus(claims);

            var properties = new Dictionary <string, object>()
            {
                [DefaultAccountResult.NewAccountPropertyName] = isNewAccount,
                [DefaultAccountResult.StatePropertyName]      = state,
                [DefaultAccountResult.StatusPropertyName]     = resultStatus,
            };

            var accountHref = GetAccountHref(claims);

            if (!string.IsNullOrEmpty(accountHref))
            {
                properties[DefaultAccountResult.AccountPropertyName] = new LinkProperty(accountHref);
            }

            return(dataStore.InstantiateWithData <IAccountResult>(properties));
        }
        internal static IAccountResult CreateAccountResult(IJwtClaims claims, IInternalDataStore dataStore)
        {
            var state = claims.GetClaim(IdSiteClaims.State);

            bool isNewAccount = (bool)claims.GetClaim(IdSiteClaims.IsNewSubject);
            var resultStatus = GetResultStatus(claims);

            var properties = new Dictionary<string, object>()
            {
                [DefaultAccountResult.NewAccountPropertyName] = isNewAccount,
                [DefaultAccountResult.StatePropertyName] = state,
                [DefaultAccountResult.StatusPropertyName] = resultStatus,
            };

            var accountHref = GetAccountHref(claims);
            if (!string.IsNullOrEmpty(accountHref))
            {
                properties[DefaultAccountResult.AccountPropertyName] = new LinkProperty(accountHref);
            }

            return dataStore.InstantiateWithData<IAccountResult>(properties);
        }