This error generally occurs when we have a function or parameter expecting non nullable value but we are passing null value.Solution
To solve this error, we can write code snippet like this
bool active = false;
if (Model != null)
active = (bool)Model.HasValue;
where bool has been converted into nullable dictionary and we are checking for Model = null and if it is not then converting it boolean. In further code we can use active variable if needed.