Cleaned code and fixed issue with getting a resource too soon after request for creation.