CA-136792: Refactor code to create only valid datasources.

Signed-off-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>