/**
  * Update Contract status
  *
  * @param $id
  * @param $status
  * @param $type
  * @return bool
  */
 public function updateStatus($id, $status, $type)
 {
     try {
         $contract = $this->contract->findContract($id);
     } catch (ModelNotFoundException $e) {
         $this->logger->error('Contract not found', ['contract id' => $id]);
         return false;
     } catch (Exception $e) {
         $this->logger->error($e->getMessage());
         return false;
     }
     if ($contract->isEditableStatus($status)) {
         $status_key = sprintf('%s_status', $type);
         $old_status = $contract->{$status_key};
         $contract->{$status_key} = $status;
         $contract->save();
         if ($status == Contract::STATUS_PUBLISHED) {
             $this->queue->push('App\\Nrgi\\Services\\Queue\\PostToElasticSearchQueue', ['contract_id' => $id, 'type' => $type], 'elastic_search');
         }
         $this->logger->activity('contract.log.status', ['type' => $type, 'old_status' => $old_status, 'new_status' => $status], $contract->id);
         $this->logger->info("Contract status updated", ['Contract id' => $contract->id, 'Status type' => $type, 'Old status' => $old_status, 'New Status' => $status]);
         return true;
     }
     return false;
 }