MDL-38359 Marking Allocation and Workflow code

based on Marking allocation work from Damyon Wiese