Func for checking values in Core data, which led to never going in the
loop , as it was already empty overall. so the for condition never met
& it never got executed. As the for loop never executed.
Also added few extra variables assigning which I forgot to check.