public RestOperation Put()
{
if (HttpRuntime.Cache[_pathManager.FindRootPath()] != null)
{
HttpRuntime.Cache.Remove(_pathManager.FindRootPath());
}
var restClientBuilder = new RestClientBuilder()
.WithUri(_pathManager.CreatePath())
.WithOAuth2Token(_token.GetAccessToken())
.WithBody(_body)
.WithAcceptHeader(_acceptHeader)
.WithContentType("application/vnd.huddle.data+json");
var response = restClientBuilder.Build().Put();
//this is fine and dandy but then we have to update any cache that holds info about this i.e thhe parent folder cache
var restClientBuilderParent = new RestClientBuilder()
.WithUri(_pathManager.FindRootPath())
.WithOAuth2Token(_token.GetAccessToken())
.WithAcceptHeader(_acceptHeader);
var parentResponse = restClientBuilderParent.Build().get();
IEnumerable<Link> linkAsArray = LinkBuilder.Build(parentResponse.Result.link);
var parentLink = linkAsArray.Single(l => l.Rel == "parent");
if (HttpRuntime.Cache[parentLink.Href] != null)
{
HttpRuntime.Cache.Remove(parentLink.Href);
HttpRuntime.Cache.Insert(parentLink.Href, parentResponse, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 10, 0));
}
return response;
}