/// <summary>
        /// Deletes the specified data.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="data">The data.</param>
        /// <returns>a task</returns>
        public async Task Delete <T>(T data) where T : BaseModel
        {
            try
            {
                // Change local
                await DataHandler.Delete(data);

                AssassinCache.Remove(data);

                // send data to server
                if (QuantWebClient != null && observingTypes.Any(p => p.TypeDescritor == typeof(T).AssemblyQualifiedName))
                {
                    await CheckConnection();

                    if (IsConnected)
                    {
                        await QuantWebClient?.Delete(data);
                    }
                }

                // delete image
                CheckForImage(data, true);
            }
            catch (Exception ex)
            {
                OnNotify?.Invoke(this, ex.ToText("Error updating data."), LogLevel.Error);
            }
        }
        /// <summary>
        /// Updates the specified data.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="data">The data.</param>
        /// <param name="updateImage">if set to <c>true</c> the image entity will also be updated.</param>
        /// <returns>a task</returns>
        public async Task Update <T>(T data, bool updateImage = false) where T : BaseModel
        {
            try
            {
                data.ModifiedDT = DateTime.UtcNow;
                data.Synced     = false;

                // change local data
                await DataHandler.Update(data);

                AssassinCache.AddOrUpdate(data);

                // send to server if observed
                if (QuantWebClient != null && observingTypes.Any(p => p.TypeDescritor == typeof(T).AssemblyQualifiedName))
                {
                    await CheckConnection();

                    if (IsConnected)
                    {
                        await QuantWebClient?.Update(data);
                    }
                }

                // update image
                if (updateImage)
                {
                    CheckForImage(data);
                }
            }
            catch (Exception ex)
            {
                OnNotify?.Invoke(this, ex.ToText("Error updating data."), LogLevel.Error);
            }
        }
        /// <summary>
        /// Checks for image.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="data">The data.</param>
        private async void CheckForImage <T>(T data, bool delete = false) where T : BaseModel
        {
            if (data.HasImage())
            {
                var image = data.GetImage();

                if (image == null)
                {
                    return;
                }

                if (delete)
                {
                    image.Delete();
                }
                else
                {
                    image.Save();
                }

                // Send to server
                if (QuantWebClient != null && observingTypes.Any(p => p.TypeDescritor == typeof(T).AssemblyQualifiedName))
                {
                    await CheckConnection();

                    if (IsConnected)
                    {
                        if (delete)
                        {
                            await QuantWebClient.DeleteImage(image);
                        }
                        else
                        {
                            await QuantWebClient.SaveImage(image);
                        }
                    }
                }
            }
        }