                         //Get the goals again to see if the goals have been updated after our post
                         APIServiceManager.sharedInstance.getUserGoals{ (success, serverMessage, serverCode, goals, err) in
                             print(goals)
-                            var currentGoalAfterPost:Goal?
                             //we want to remove the news goal so find it
                             for goal in goals! {
-                                if goal.activityCategoryName == "news" {
-                                    currentGoalAfterPost = goal
+                                //Now we Identify the goals by their activity category links
+                                if goal.activityCategoryLink == socialActivityCategoryLink {
+                                    print(goal.activityCategoryLink)
+                                    XCTAssertTrue(goal.activityCategoryLink == socialActivityCategoryLink, "Goal has been posted")
+                                    expectation.fulfill()
                                 }
-                            }
-                            //now we have the goal we posted...returned from current goals, so check it's category is the
-                            if let currentGoalAfterPost = currentGoalAfterPost {
-                                let currentGoalAfterPostID = currentGoalAfterPost.goalID!
-                                print(currentGoalAfterPostID)
-                                XCTAssertTrue(currentGoalAfterPost.activityCategoryLink == socialActivityCategoryLink, "Goal has been posted")
-                                expectation.fulfill()
                             }
                         }
                     } else {

                if success == false{
                    XCTFail()
                }
                print(KeychainManager.sharedInstance.getYonaPassword())

                //body we want to post
                let socialActivityCategoryLink = "http://85.222.227.142/activityCategories/27395d17-7022-4f71-9daf-f431ff4f11e8"
                let bodyTimeZoneSocialGoal = [
                    "@type": "TimeZoneGoal",

            //we need to now get the activity link from our activities
            APIServiceManager.sharedInstance.getActivityLinkForActivityName(.socialString, onCompletion: { (success, socialActivityCategoryLink, message, code) in
                    //set body for goal
                    APIServiceManager.sharedInstance.getActivityLinkForActivityName(.newsString, onCompletion: { (success, newsActivityCategoryLink, message, code) in
                        
                        //now we can post the goal
