public function fillFields()
    {
        // Fill the fields from $_POST array
        foreach ($_POST as $key => $val) {
            
            // Get int value form field parent id
            if ($key == 'ParentID' && $val == 0) {
                
                $this[$key] = null;
                
                // Get other fields
            } elseif ($key != 'StructureID') {
                
                $this[$key] = $val;
            }
        }

        // Save data about application
        $this['applicationGenerate'] = isset($_POST['generate-application'])&&($_POST['generate-application'] == true) ? 1 : 0;
        $this['applicationOutput'] = isset($_POST['output-application'])&&($_POST['output-application'] == true) ? 1 : 0;
        $this['applicationOutputStructure'] = isset($_POST['output-structure-application'])&&($_POST['output-structure-application'] == true) ? 1 : 0;
        $this['applicationRenderMain'] = isset($_POST['render-main-application'])&&($_POST['render-main-application'] == true) ? 1 : 0;

        // If application need to generate then set system property to 1 or 0
        $this['system'] = isset($_POST['generate-application'])&&($_POST['generate-application'] == true) ? 1: 0;

        // Save icon
        $icon = isset($_POST['icon-application']) ? filter_var($_POST['icon-application']) : null;
        if (strlen($icon) > 0) {
            $this['applicationIcon'] = $icon;
        }

        /** TODO: Authenticated user can be not instance of user table */
        if (!$this->query->entity('\samson\activerecord\user')->where('user_id', $this->UserID)->first()) {
            $this->UserID = 1;
        }
        // Save object
        $this->save();

        if (isset($_POST['ParentID']) && $_POST['ParentID'] != 0) {
            // Create new relation
            $strRelation = new \samson\activerecord\structure_relation(false);
            $strRelation->parent_id = $_POST['ParentID'];
            $strRelation->child_id = $this->id;

            // Save relation
            $strRelation->save();
        }
    }