public bool AddPreferredLocation(string[] location, int userid) { try { var status = true; for (int i = 0; i < location.Length; i++) { if (!_jobPostProcessor.AddPreferredLocation(location[i], i + 1, userid)) { return(false);//break; } } return(status); }catch (Exception ex) { throw new Exception("Unable to add location"); } }