private TResponse Execute <TResponse>(Request <TResponse> request, bool authenticationRequired) where TResponse : class { if (authenticationRequired) { SetAuthenticationToken(request); } var restResponse = _httpRequester.ExecuteRequest(request); if (restResponse.HttpStatusCode == 200) { var response = (Response <TResponse>)Activator.CreateInstance(typeof(Response <TResponse>), restResponse.ResponseContent); var resource = response.GetResource(); return(resource); } throw new RequestErrorException(restResponse.HttpStatusCode, restResponse.ResponseContent); }