public Long doInBackground() throws NotRegisteredException, IOException{
String resultString = null;
if (webServiceREST.isUserRegistered()){
//sending request to server
resultString = webServiceREST.sendFavoriteRequest(thought);
Thought modifiedThought = new Thought(thought);
modifiedThought.setFavorite(!thought.isFavorite());
//update cached last thoughts
if (cachedLastThoughts.getMap().containsKey(thought.getID())){
cachedLastThoughts.getMap().get(thought.getID()).setFavorite(modifiedThought.isFavorite());
cachedLastThoughts.saveToFile();
} else {
//Nothing to do
}
//update cached favorite thoughts
if (modifiedThought.isFavorite()){
cachedFavoriteThought.addAndSaveToFile(modifiedThought.getID(), modifiedThought);
} else {
cachedFavoriteThought.getMap().remove(thought.getID());
}
} else {