[BZ-1077116] throw an UnsupportedOperationException when trying to create a new Command in legacy API
(cherry picked from commit d416a43129ca55da5556a79e9e8def8ff58d6bc8)