Inheritance: IServiceResponse
        public IServiceResponse SetFolderSyncSetting(string teamFolderId, string syncSetting, string authToken)
        {
            IServiceResponse serviceResponse = null;
            try
            {
                if (!string.IsNullOrEmpty(SyncSettingTeamFolderUrl))
                {
                    RestClient client = new RestClient(string.Format("{0}/{1}/", _baseUrl, _apiVersion));
                    RestRequest request = new RestRequest(SyncSettingTeamFolderUrl, Method.POST);
                    request.AddHeader("Authorization", Convert.ToString("Bearer ") + authToken);
                    request.AddHeader("Content-Type", "application/json");

                    JObject json = new JObject(
                        new JProperty("team_folder_id", teamFolderId),
                        new JProperty("default_sync_setting", syncSetting)
                    );
                    request.AddParameter("application/json", json, ParameterType.RequestBody);

                    request.RequestFormat = DataFormat.Json;
                    client.UserAgent = UserAgentVersion;
                    IRestResponse response = client.Execute(request);
                    serviceResponse = new ServiceResponse(response.StatusCode, response.ErrorMessage);
                }
                else
                {
                    throw new ArgumentNullException("Missing service url");
                }
            }
            catch (Exception e)
            {
                serviceResponse = new ServiceResponse(HttpStatusCode.InternalServerError, e.Message);
            }
            return serviceResponse;
        }
        public IServiceResponse AddMember(IMemberData data, string authToken)
        {
            IServiceResponse serviceResponse = null;
            try
            {
                if (!string.IsNullOrEmpty(AddMemberUrl))
                {
                    RestClient client = new RestClient(
                        string.Format("{0}/{1}/", _baseUrl, _apiVersion)
                    );
                    RestRequest request = new RestRequest(AddMemberUrl, Method.POST);
                    request.AddHeader("Authorization", "Bearer " + authToken);
                    request.AddHeader("Content-Type", "application/json");

                    //currently creates all as member only and sends email (could be altered)
                    JObject jsonProv = new JObject(
                        new JProperty("new_members",
                            new JArray(
                                new JObject(
                                    new JProperty("member_email", data.Email),
                                    new JProperty("member_given_name", data.FirstName),
                                    new JProperty("member_surname", data.LastName),
                                    new JProperty("send_welcome_email", data.SendWelcomeEmail),
                                    new JProperty("role",
                                        new JObject(
                                            new JProperty(".tag", data.RoleName)
                                        )
                                    )
                                )
                            )
                        ),
                        new JProperty("force_async", false)
                    );
                    request.AddParameter("application/json", jsonProv, ParameterType.RequestBody);
                    request.RequestFormat = DataFormat.Json;
                    client.UserAgent = UserAgentVersion;
                    IRestResponse response = client.Execute(request);
                    serviceResponse = new ServiceResponse(response.StatusCode, response.Content);
                }
                else
                {
                    throw new ArgumentNullException("Missing service url");
                }
            }
            catch (Exception e)
            {
                serviceResponse = new ServiceResponse(HttpStatusCode.InternalServerError, e.Message);
            }
            return serviceResponse;
        }
        public IServiceResponse SetProfile(IMemberData data, string authToken)
        {
            IServiceResponse serviceResponse = null;
            try
            {
                if (!string.IsNullOrEmpty(SetProfileUrl))
                {
                    RestClient client = new RestClient(
                        string.Format("{0}/{1}/", _baseUrl, _apiVersion)
                    );
                    RestRequest request = new RestRequest(SetProfileUrl, Method.POST);
                    request.AddHeader("Authorization", "Bearer " + authToken);
                    request.AddHeader("Content-Type", "application/json");

                    //if we are updating external id also
                    if (!string.IsNullOrEmpty(data.NewExternalId))
                    {
                        JObject jsonProv = new JObject(
                        new JProperty("user",
                                new JObject(
                                    new JProperty(".tag", "email"),
                                    new JProperty("email", data.Email)
                                )
                        ),
                        new JProperty("new_email", data.NewEmail),
                        new JProperty("new_external_id", data.NewExternalId)
                        );
                        request.AddParameter("application/json", jsonProv, ParameterType.RequestBody);
                    }
                    //if we are not updating external id
                    if (string.IsNullOrEmpty(data.NewExternalId))
                    {
                        JObject jsonProv = new JObject(
                        new JProperty("user",
                                new JObject(
                                    new JProperty(".tag", "email"),
                                    new JProperty("email", data.Email)
                                )
                        ),
                        new JProperty("new_email", data.NewEmail)
                        );
                        request.AddParameter("application/json", jsonProv, ParameterType.RequestBody);
                    }       
                    request.RequestFormat = DataFormat.Json;
                    client.UserAgent = UserAgentVersion;
                    IRestResponse response = client.Execute(request);
                    serviceResponse = new ServiceResponse(response.StatusCode, response.ErrorMessage);
                }
                else
                {
                    throw new ArgumentNullException("Missing service url");
                }
            }
            catch (Exception e)
            {
                serviceResponse = new ServiceResponse(HttpStatusCode.InternalServerError, e.Message);
            }
            return serviceResponse;
        }
        public IServiceResponse DeleteMemberGroup(IMemberData data, string email, string authToken)
        {
            IServiceResponse serviceResponse = null;
            try
            {
                if (!string.IsNullOrEmpty(DeleteMemberGroupUrl))
                {
                    RestClient client = new RestClient(
                        string.Format("{0}/{1}/", _baseUrl, _apiVersion)
                    );
                    RestRequest request = new RestRequest(DeleteMemberGroupUrl, Method.POST);
                    request.AddHeader("Authorization", "Bearer " + authToken);
                    request.AddHeader("Content-Type", "application/json");

                    JObject json = new JObject(
                        new JProperty("group",
                                        new JObject(
                                            new JProperty(".tag", "group_id"),
                                            new JProperty("group_id", data.GroupId)
                                        )
                                    ),
                        new JProperty("users",
                            new JArray(
                                new JObject(
                                    new JProperty(".tag", "email"),
                                    new JProperty("email", email)
                                )
                            )
                        ),
                        new JProperty("return_members", false)
                    );
                    request.AddParameter("application/json", json, ParameterType.RequestBody);
                    request.RequestFormat = DataFormat.Json;
                    client.UserAgent = UserAgentVersion;
                    IRestResponse response = client.Execute(request);
                    serviceResponse = new ServiceResponse(response.StatusCode, response.ErrorMessage);
                }
                else
                {
                    throw new ArgumentNullException("Missing service url");
                }
            }
            catch (Exception e)
            {
                serviceResponse = new ServiceResponse(HttpStatusCode.InternalServerError, e.Message);
            }
            return serviceResponse;
        }
        public IServiceResponse CreateGroup(string groupName, string authToken)
        {
            IServiceResponse serviceResponse = null;
            try
            {
                if (!string.IsNullOrEmpty(CreateGroupUrl))
                {
                    RestClient client = new RestClient(string.Format("{0}/{1}/", _baseUrl, _apiVersion));
                    RestRequest request = new RestRequest(CreateGroupUrl, Method.POST);
                    request.AddHeader("Authorization", Convert.ToString("Bearer ") + authToken);
                    request.AddHeader("Content-Type", "application/json");

                    JObject json = new JObject(
                        new JProperty("group_name", groupName)
                    );

                    request.AddParameter("application/json", json, ParameterType.RequestBody);
                    request.RequestFormat = DataFormat.Json;
                    client.UserAgent = UserAgentVersion;
                    IRestResponse response = client.Execute(request);
                    serviceResponse = new ServiceResponse(response.StatusCode, response.Content);
                }
                else
                {
                    throw new ArgumentNullException("Missing service url");
                }
            }
            catch (Exception e)
            {
                serviceResponse = new ServiceResponse(HttpStatusCode.InternalServerError, e.Message);
            }
            return serviceResponse;
        }
        public IServiceResponse RemoveMember(IMemberData data, string authToken)
        {
            IServiceResponse serviceResponse = null;
            bool wipeData = true;
            if (data.KeepAccount)
            {
                wipeData = false;
            }
            try
            {
                if (!string.IsNullOrEmpty(RemoveMemberUrl))
                {
                    RestClient client = new RestClient(
                        string.Format("{0}/{1}/", _baseUrl, _apiVersion)
                    );
                    RestRequest request = new RestRequest(RemoveMemberUrl, Method.POST);
                    request.AddHeader("Authorization", "Bearer " + authToken);
                    request.AddHeader("Content-Type", "application/json");

                    JObject jsonProv = new JObject(
                        new JProperty("user",
                                new JObject(
                                    new JProperty(".tag", "email"),
                                    new JProperty("email", data.Email)
                                )
                        ),
                        new JProperty("wipe_data", wipeData),
                        new JProperty("keep_account", data.KeepAccount)
                    );
                    request.AddParameter("application/json", jsonProv, ParameterType.RequestBody);
                    request.RequestFormat = DataFormat.Json;
                    client.UserAgent = UserAgentVersion;
                    IRestResponse response = client.Execute(request);
                    serviceResponse = new ServiceResponse(response.StatusCode, response.ErrorMessage);
                }
                else
                {
                    throw new ArgumentNullException("Missing service url");
                }
            }
            catch (Exception e)
            {
                serviceResponse = new ServiceResponse(HttpStatusCode.InternalServerError, e.Message);
            }
            return serviceResponse;
        }