// adds or returns the actual Recipe record (id)
        private int createRecipeRecord(RecipeObj recipe)
        {
            using (var context = new WoolworthsDBDataContext())
            {
                var existing = context.Recipes.SingleOrDefault(r => r.ID == recipe.RecipeID);

                // if the recipe already exists and the action isn't to update then just return the recipe identifier
                if (existing != null) //Always update, regardless of action (well, it should be "i" or "u" -- && recipe.Action.ToLower() == "u")
                {
                    // if the recipe exists and the instruction is to update then updates
                    existing.CookingTime    = recipe.CookingTime;
                    existing.Description    = recipe.Description;
                    existing.Recipe1        = recipe.Recipe;
                    existing.ImageURL       = downloadRemoteImageFile(recipe.ImageURL, ImgDir, recipe.Recipe);
                    existing.OriginImageUrl = recipe.ImageURL;
                    existing.PrepTime       = recipe.PreparationTime;
                    existing.Serves         = recipe.Serves;
                    existing.Tip            = recipe.Tip;
                    existing.Title          = recipe.Title;
                    existing.TotalTime      = recipe.TotalTime;
                    context.SubmitChanges();
                    return(existing.ID);
                }
                else
                {
                    // create the record regardless of whether it was an insert or update record
                    var newRecipe = new WoolworthsDAL.Recipe
                    {
                        ID             = recipe.RecipeID,
                        CookingTime    = recipe.CookingTime,
                        Recipe1        = recipe.Recipe,
                        Description    = recipe.Description,
                        ImageURL       = downloadRemoteImageFile(recipe.ImageURL, ImgDir, recipe.Recipe),
                        OriginImageUrl = recipe.ImageURL,
                        PrepTime       = recipe.PreparationTime,
                        Serves         = recipe.Serves,
                        Tip            = recipe.Tip,
                        Title          = recipe.Title,
                        TotalTime      = recipe.TotalTime
                    };
                    context.Recipes.InsertOnSubmit(newRecipe);
                    context.SubmitChanges();
                    return(newRecipe.ID);
                }
            }
        }
        // adds or returns the actual Recipe record (id)
        private int createRecipeRecord(RecipeObj recipe)
        {
            using (var context = new WoolworthsDBDataContext())
            {
                var existing = context.Recipes.SingleOrDefault(r => r.ID == recipe.RecipeID);

                // if the recipe already exists and the action isn't to update then just return the recipe identifier
                if (existing != null) //Always update, regardless of action (well, it should be "i" or "u" -- && recipe.Action.ToLower() == "u")
                {
                    // if the recipe exists and the instruction is to update then updates
                    existing.CookingTime = recipe.CookingTime;
                    existing.Description = recipe.Description;
                    existing.Recipe1 = recipe.Recipe;
                    existing.ImageURL = downloadRemoteImageFile(recipe.ImageURL, ImgDir, recipe.Recipe);
                    existing.OriginImageUrl = recipe.ImageURL;
                    existing.PrepTime = recipe.PreparationTime;
                    existing.Serves = recipe.Serves;
                    existing.Tip = recipe.Tip;
                    existing.Title = recipe.Title;
                    existing.TotalTime = recipe.TotalTime;
                    context.SubmitChanges();
                    return existing.ID;
                }
                else 
                {
                    // create the record regardless of whether it was an insert or update record
                    var newRecipe = new WoolworthsDAL.Recipe
                    {
                        ID = recipe.RecipeID,
                        CookingTime = recipe.CookingTime,
                        Recipe1 = recipe.Recipe,
                        Description = recipe.Description,
                        ImageURL = downloadRemoteImageFile(recipe.ImageURL, ImgDir, recipe.Recipe),
                        OriginImageUrl = recipe.ImageURL,
                        PrepTime = recipe.PreparationTime,
                        Serves = recipe.Serves,
                        Tip = recipe.Tip,
                        Title = recipe.Title,
                        TotalTime = recipe.TotalTime
                    };
                    context.Recipes.InsertOnSubmit(newRecipe);
                    context.SubmitChanges();
                    return newRecipe.ID;
                }
            }
        }