public function updateCareerHistory(Request $request)
 {
     $validator = Validator::make($request->all(), []);
     DB::transaction(function () use($request) {
         $managerProfile = ManagerProfile::where('user_id', '=', session(SiteSessions::USER_ID))->first();
         $managerProfile->institution_type = $request->institution_type;
         $managerProfile->institution_name = $request->institution_name;
         $managerProfile->save();
         $careerHistories = $request->careerHistory;
         foreach ($careerHistories as $careerHistory) {
             $managerCareerHistory = null;
             //Checking if career history already exists
             if ($managerCareerHistory = ManagerCareerHistory::CareerHistoryExists($managerProfile->profile_id, $careerHistory["year"])) {
             } else {
                 $managerCareerHistory = ManagerCareerHistory::create(['profile_id' => $managerProfile->profile_id, 'career_year' => $careerHistory["year"]]);
             }
             $achievements = $careerHistory["achievement"];
             foreach ($achievements as $achievement) {
                 //Checking if Achievement already exists for Career History
                 if (ManagerCareerHistoryAchievement::AchievementExists($managerCareerHistory->id, $achievement["info"])) {
                 } else {
                     $managerCareerHistory->Achievements()->save(new ManagerCareerHistoryAchievement(['achievement' => $achievement["info"]]));
                 }
             }
             //Removing Obselete Achievements
             ManagerCareerHistoryAchievement::RemoveObseleteAchievement($managerCareerHistory, $achievements);
         }
         ManagerCareerHistory::RemoveObseleteCareerHistory($managerProfile, $careerHistories);
     });
     $this->sendResponse();
 }
 public function getCareerHistory(Request $request)
 {
     $managerProfile = null;
     try {
         $managerProfile = ManagerProfile::getManagerProfile(Session::get(SiteSessions::USER_ID));
     } catch (ModelNotFoundException $e) {
         $this->updateRequestStatus(RequestStatusEnum::MODEL_NOT_FOUND);
         return $this->sendResponse();
     }
     $managerCareerHistory = ManagerCareerHistory::getCareerHistoryAndAchievements($managerProfile->profile_id);
     return $this->sendResponse(["careerHistory" => $managerCareerHistory]);
 }