public StudentRecord getStudentRecordFromSouce(string id, string session, out int categoryid) { ProfileServiceClient client = new ProfileServiceClient(); categoryid = 1; StudentRecord sr = client.getStudentRecordWithSession(id, session); if (sr == null || sr.MatricNo == null) { if (dbcontext.Configs.Any(p => p.ConfigName == "PGCurrentSession")) { session = dbcontext.Configs.First(p => p.ConfigName == "PGCurrentSession").ConfigValue; } sr = getStudentRecordFromPGSouce(id, session); categoryid = 2; } return(sr); }