Move flattening to the action engine compiler

Since flattening is only one way to compile a flow and
nested flows and atoms into a compilation unit move this
functionality into the engine module where it is used.

Change-Id: Ifea6b56cf5f2a9c1d16acabfaae6f28aeb6534a0
Merge "Move flattening to the action engine compiler"