public async Task <IEnumerable <Promise> > GetPromises(ApplicationUser user)
        {
            var count = await GetPromiseCount(user);

            if (count == 0)
            {
                return(null);
            }

            var keys = await Task.WhenAll(Enumerable.Range(1, count)
                                          .Select(i => SmartPromiseConverter.GetPromiseKeyHex(user.Address, i, _blockchain)));

            var promises = await LoadPromises(keys);

            return(promises);
        }
        public async Task <Promise> Get(int id, ApplicationUser user)
        {
            try
            {
                var promiseKeyHex = await SmartPromiseConverter.GetPromiseKeyHex(user.Address, id, _blockchain);

                var promiseJsonHex = await _blockchain.GetStorage(NETWORK_TYPE.TESTNET, promiseKeyHex);

                var promiseJson = SmartPromiseConverter.Hex2Str(promiseJsonHex);
                return(JsonConvert.DeserializeObject <Promise>(promiseJson));
            }
            catch (Exception ex)
            {
                return(null);
            }
        }