}
Community editCommunity = filledForm.get();
//Determine if the edited community is changed from original. i.e. don't update unless necessary
RestResponse originalCommunityResponse = Community.findByID(id);
Community originalCommunity = null;
if(originalCommunityResponse.modelObject instanceof Community) {
originalCommunity = (Community) originalCommunityResponse.modelObject;
}
if(editCommunity.equals(originalCommunity)) {
Logger.info("Communities are equal, nothing to do");
flash("success", "No changes to community detected");
return redirect(routes.Communities.show(id));
} else {
editCommunity.id = originalCommunity.id;
RestResponse restResponse = editCommunity.update(user.token());
HttpResponse httpResponse = restResponse.httpResponse;
if(httpResponse.getStatusLine().getStatusCode() == 200) {
Logger.info("ok");
flash("success", "Community has been updated.");
return redirect(routes.Communities.show(id));