MDL-38359 Marking Allocation and Workflow code

based on Marking workflow code from Damyon Wiese