private async Task AddMembersOf(Resource resource)
        {
            WindowsAzureActiveDirectory2Group group = resource as WindowsAzureActiveDirectory2Group;

            if (group != null && group.Members != null && group.Members.Any())
            {
                foreach (Member member in group.Members)
                {
                    MemberColumnsFactory memberColumnsFactory          = new MemberColumnsFactory(resource, member);
                    IReadOnlyDictionary <string, string> memberColumns = memberColumnsFactory.CreateColumns();
                    await this.file.InsertRow(memberColumns);
                }
            }
        }
        private async Task UpdateMembersAsync(Resource resource, IPatch patch)
        {
            if (null == resource)
            {
                throw new ArgumentNullException(nameof(resource));
            }

            if (null == patch)
            {
                throw new ArgumentNullException(nameof(patch));
            }

            if (null == patch.ResourceIdentifier)
            {
                throw new ArgumentException(FileProviderResources.ExceptionInvalidPatch);
            }

            if (string.IsNullOrWhiteSpace(patch.ResourceIdentifier.Identifier))
            {
                throw new ArgumentException(FileProviderResources.ExceptionInvalidPatch);
            }

            if (string.IsNullOrWhiteSpace(patch.ResourceIdentifier.SchemaIdentifier))
            {
                throw new ArgumentException(FileProviderResources.ExceptionInvalidPatch);
            }

            if (null == patch.PatchRequest)
            {
                throw new ArgumentException(FileProviderResources.ExceptionInvalidPatch);
            }

            PatchRequest2 patchRequest = patch.PatchRequest as PatchRequest2;

            if (null == patchRequest)
            {
                string unsupportedPatchTypeName = patch.GetType().FullName;
                throw new NotSupportedException(unsupportedPatchTypeName);
            }

            if
            (
                !FileProvider
                .SchemaIdentifiersGroup
                .Value
                .Any(
                    (string item) =>
                    string.Equals(item, patch.ResourceIdentifier.SchemaIdentifier, StringComparison.Ordinal))
            )
            {
                return;
            }

            IReadOnlyCollection <PatchOperation> memberOperations =
                patchRequest
                .Operations
                .Where(
                    (PatchOperation item) =>
                    item.Path != null &&
                    string.Equals(item.Path.AttributePath, AttributeNames.Members, StringComparison.Ordinal))
                .ToArray();

            if (!memberOperations.Any())
            {
                return;
            }

            foreach (PatchOperation memberOperation in memberOperations)
            {
                if (null == memberOperation.Value)
                {
                    continue;
                }

                foreach (OperationValue value in memberOperation.Value)
                {
                    if (string.IsNullOrWhiteSpace(value.Value))
                    {
                        continue;
                    }

                    Dictionary <string, string> columnsQuery =
                        new Dictionary <string, string>()
                    {
                        {
                            AttributeNames.Schemas,
                            patch.ResourceIdentifier.SchemaIdentifier
                        },
                        {
                            AttributeNames.Identifier,
                            patch.ResourceIdentifier.Identifier
                        },
                        {
                            AttributeNames.Members,
                            value.Value
                        }
                    };
                    IRow[] rows = await this.file.Query(columnsQuery);

                    switch (memberOperation.Name)
                    {
                    case OperationName.Add:
                        if (rows.Any())
                        {
                            break;
                        }

                        Member member =
                            new Member()
                        {
                            Value = value.Value
                        };
                        MemberColumnsFactory memberColumnsFactory          = new MemberColumnsFactory(resource, member);
                        IReadOnlyDictionary <string, string> columnsMember = memberColumnsFactory.CreateColumns();
                        await this.file.InsertRow(columnsMember);

                        break;

                    case OperationName.Remove:
                        foreach (IRow row in rows)
                        {
                            await this.file.RemoveRow(row.Key);
                        }

                        break;
                    }
                }
            }
        }