core: refactoring in CommandsFactory

Extract the code that instantiate the command to separate method

Change-Id: Ib1d15d69afad9cefad95d0d266a495e3d95cd6e4
Signed-off-by: Arik Hadas <ahadas@redhat.com>