Dev2.DynamicServices.FileSystemInstanceStore.ProcessSaveWorkflow C# (CSharp) Method

ProcessSaveWorkflow() private method

private ProcessSaveWorkflow ( System.Runtime.DurableInstancing.InstancePersistenceContext context, System.Activities.DurableInstancing.SaveWorkflowCommand command ) : Exception
context System.Runtime.DurableInstancing.InstancePersistenceContext
command System.Activities.DurableInstancing.SaveWorkflowCommand
return System.Exception
        private Exception ProcessSaveWorkflow(
            InstancePersistenceContext context,
            SaveWorkflowCommand command)
        {
            try
            {
                if(command.CompleteInstance)
                {
                    _dataStore.DeleteInstance(
                        context.InstanceView.InstanceId);
                    _dataStore.DeleteInstanceAssociation(
                        context.InstanceView.InstanceId);
                    return null;
                }

                if(command.InstanceData.Count > 0 ||
                    command.InstanceMetadataChanges.Count > 0)
                {
                    if(!_dataStore.SaveAllInstanceData(
                        context.InstanceView.InstanceId, command))
                    {
                        _dataStore.SaveAllInstanceMetaData(
                            context.InstanceView.InstanceId, command);
                    }
                }

                if(command.InstanceKeysToAssociate.Count > 0)
                {
                    foreach(var entry in command.InstanceKeysToAssociate)
                    {
                        _dataStore.SaveInstanceAssociation(
                            context.InstanceView.InstanceId, entry.Key, false);
                    }
                }
                return null;
            }
            catch(InstancePersistenceException exception)
            {
                Console.WriteLine(
                    // ReSharper disable LocalizableElement
                    "ProcessSaveWorkflow exception: {0}", exception.Message);
                // ReSharper restore LocalizableElement
                return exception;
            }
        }