private CResultCreate GetCustomerData(string customerSessionId)
        {
            try
            {
                ConfigEnv configData = GetConfigData();

                CDataCustomer customer = new CDataCustomer();
                customer.session_id = customerSessionId;

                ILoyalzooCustomer c = new Customer();
                CResultCreate     loyalzooResult = c.Me(configData, customer);

                return(loyalzooResult);
            }
            catch (Exception e)
            {
                CResultCreate exceptionData = new CResultCreate();
                exceptionData.success  = false;
                exceptionData.response = null;
                exceptionData.Errore   = new Errore {
                    success = false, response = e.Message
                };

                return(exceptionData);
            }
        }
        public APIResult CreateLoyalzooAccount(LoyalzooUserPart loyalzooPart, string username, string email)
        {
            try
            {
                APIResult result = new APIResult();

                if (loyalzooPart != null && !String.IsNullOrWhiteSpace(username) && !String.IsNullOrWhiteSpace(email))
                {
                    if (String.IsNullOrWhiteSpace(loyalzooPart.LoyalzooUsername) && String.IsNullOrWhiteSpace(loyalzooPart.LoyalzooPassword) && String.IsNullOrWhiteSpace(loyalzooPart.CustomerSessionId))
                    {
                        ConfigEnv configData = GetConfigData();

                        CDataCustomer customerData = new CDataCustomer();
                        customerData.first_name = username;
                        customerData.email      = email;
                        customerData.username   = username;
                        customerData.password   = Membership.GeneratePassword(12, 4);

                        ILoyalzooCustomer customer        = new Customer();
                        CResultCreate     creationRequest = customer.Create(configData, customerData);

                        if (creationRequest.success)
                        {
                            loyalzooPart.LoyalzooUsername  = creationRequest.response.username;
                            loyalzooPart.CustomerSessionId = creationRequest.response.session_id;
                            loyalzooPart.LoyalzooPassword  = Convert.ToBase64String(_encryptionService.Encode(Encoding.UTF8.GetBytes(customerData.password)));

                            result.success = true;
                            result.data    = creationRequest.response;
                            result.message = "";
                        }
                        else
                        {
                            result.success = false;
                            result.message = creationRequest.Errore.response;
                            result.data    = null;
                        }
                    }
                    else
                    {
                        return new APIResult {
                                   success = false, data = null, message = "There is already some Loyalzoo data associated to the user. If you want to register a new account, delete the existing Loyalzoo data and then call this method again (any previous data associated to the user will be lost)."
                        }
                    };
                }
                else
                {
                    return new APIResult {
                               success = false, data = null, message = "The user is not configured to use Loyalzoo."
                    }
                };

                return(result);
            }
            catch (Exception e)
            {
                APIResult exceptionData = new APIResult();

                exceptionData.success = false;
                exceptionData.message = e.Message;
                exceptionData.data    = null;

                return(exceptionData);
            }
        }