public static string AddUser(User user, CancellationToken token)
 {
     if (DALCancellationTokenHandler.handle(token))
     {
         return(null);
     }
     user.Id = Guid.NewGuid().ToString();
     if (_userStore.TryAdd(user.Id, user))
     {
         return(user.Id);
     }
     return(null);
 }
        public static void AddUserRoles(string userId, Role[] roles, CancellationToken token)
        {
            if (DALCancellationTokenHandler.handle(token))
            {
                return;
            }
            ValidateUser(userId);

            if (_userRoles.TryAdd(userId, roles))
            {
                return;
            }
            throw new ArgumentException("could not add the roles for the user " + userId);
        }
        public static void AddUserAddress(string userId, Address[] addresses, CancellationToken token)
        {
            if (DALCancellationTokenHandler.handle(token))
            {
                return;
            }
            ValidateUser(userId);

            if (_userAddressStore.TryAdd(userId, addresses) && _userAddresses.TryAdd(userId, addresses.Select(x => x.Id).ToArray()))
            {
                return;
            }
            throw new ArgumentException("could not add the address for the user " + userId);
        }