public List <UserModel> GetUsersByProject(int projectId, int loggedinUserPfid) { log.Debug(MethodHelper.GetCurrentMethodName() + " Method execution start."); List <UserModel> userList = null; try { using (ProjectDB projectDB = new ProjectDB()) { userList = projectDB.GetUsersByProject(projectId); } if (userList.Count > 0) { var loggedinUser = userList.FirstOrDefault(m => m.Pfid == loggedinUserPfid); if (loggedinUser != null) { userList.Remove(loggedinUser); } } return(userList); } catch (Exception exception) { errorLog.Fatal("Exception " + exception.Message + "\n" + exception.StackTrace); throw; } finally { log.Debug(MethodHelper.GetCurrentMethodName() + " Method execution end."); } }