public void GetById() { try { Departments dep = _model.GetById(DepartmentId); DepartmentId = dep.Id; DepartmentName = dep.DepartmentName; Timer = Convert.ToBase64String(dep.Timer); } catch (NullReferenceException) { DepartmentName = "not found"; } catch (Exception ex) { DepartmentName = "not found"; Console.WriteLine("Problem in " + GetType().Name + " " + MethodBase.GetCurrentMethod().Name + " " + ex.Message); throw ex; } }