if (isset($_POST["layout_id_" . $index])) {
            $edit_fields[] = $_POST["layout_id_" . $index];
        }
    }
}
$deleted_fields = $layoutLine1->mark_deletedByid("component_id", $return_id, $edit_fields);
$sum = 0;
for ($i = 0; $i < $count; $i++) {
    if (substr_count($keys[$i], "number_lots_") > 0) {
        $index = substr($keys[$i], -1, 1);
        if (!isset($_POST["layout_id_" . $index]) || is_null($_POST["layout_id_" . $index]) || empty($_POST["layout_id_" . $index])) {
            $number_lots = $_POST["number_lots_" . $index];
            $number_units = $_POST["number_units_" . $index];
            $run_style = $_POST["run_style_" . $index];
            $format = $_POST["press_format"];
            $layoutLine = new Layoutline();
            $layoutLine->name = $component->genLayoutname($index, $component->name);
            $layoutLine->number_lots = $number_lots;
            $layoutLine->number_units = $number_units;
            $layoutLine->run_style = $run_style;
            $layoutLine->format = $format;
            $layoutLine->component_id = $component->id;
            $layoutLine->save();
            //Create press, presslines and pass data
            $press = new Press();
            $pressLine = new Pressline();
            $press_machine = $component->get_pressmachine_by_format($format);
            $press->pressmachine_id = $press_machine['id'];
            $press->pressmachine_name = $press_machine['name'];
            $press->save();
            $pressLine->component_id = $component->id;
 function getLayoutRows()
 {
     $return_array = array();
     if ($this->id != "") {
         $layoutline = new Layoutline();
         $return_array = $layoutline->get_full_list("id", "component_id='" . $this->id . "'");
     }
     return $return_array;
 }