Following line throw exception if there is no matching record
found.
Guid stuId= context.Students.FirstOrDefault(x => x.Name == student.Name).Id;
I understand, i can handle above line
var stuId= context.Students.FirstOrDefault(x => x.Name == student.Name);
if (stuId){}else{}
But,
Can i make the same line more smarter to handle no sequence found error
Guid stuId= context.Students.FirstOrDefault(x => x.Name == student.Name).Id;