public ActionResult <RecipeModel[]> GetRecipes(long id, int classification)
        {
            var productType = _productManagement.LoadType(id);

            if (productType == null)
            {
                return(BadRequest($"ProductType is null"));
            }
            var recipes      = _productManagement.GetRecipes(productType, (RecipeClassification)classification);
            var recipeModels = new List <RecipeModel>();

            foreach (var recipe in recipes)
            {
                recipeModels.Add(ProductConverter.ConvertRecipe(recipe));
            }
            return(recipeModels.ToArray());
        }
        public ProductModel ConvertProduct(IProductType productType, bool flat)
        {
            // Base object
            var identity  = (ProductIdentity)productType.Identity ?? EmptyIdentity;
            var converted = new ProductModel
            {
                Id         = productType.Id,
                Type       = productType.GetType().Name,
                Name       = productType.Name,
                State      = productType.State,
                Identifier = identity.Identifier,
                Revision   = identity.Revision
            };

            if (flat)
            {
                return(converted);
            }

            // Properties
            var properties = productType.GetType().GetProperties();

            converted.Properties = EntryConvert.EncodeObject(productType, ProductSerialization);

            // Files
            converted.Files = (from property in properties
                               where property.PropertyType == typeof(ProductFile)
                               select(ProductFile) property.GetValue(productType)).ToArray();
            converted.FileModels = ConvertFiles(productType, properties);

            // Recipes
            var recipes = _productManagement.GetRecipes(productType, RecipeClassification.CloneFilter);

            converted.Recipes = recipes.Select(ConvertRecipe).ToArray();

            // Parts
            ConvertParts(productType, properties, converted);

            return(converted);
        }