This requires refactoring of code to add this functionality. Along with that this patch contains regression test cases.